### 云端 MCP:序列助手 import httpx def generate_sequence(rule: str, length: int = 10) -> list[int]: """ 按给定递推规则生成整数序列 例:generate_sequence("a(n)=a(n-1)+2**(n-2),a(1)=2", 8) """ url = "https://web-mcp.ziziyi.com/sequence/generate" r = httpx.post(url, json={"rule": rule, "length": length}, timeout=10) return r.json()["sequence"] def predict_next(seq: list[int], k: int = 3) -> list[int]: """ 根据已知序列预测后续 k 项 """ url = "https://web-mcp.ziziyi.com/sequence/predict" r = httpx.post(url, json={"sequence": seq, "k": k}, timeout=10) return r.json()["prediction"] ### 云端 MCP:逻辑验证 def solve_smt(formula: str) -> bool: """ 用 Z3 在线验证公式是否对所有 n 成立 例:solve_smt("forall n: 1<=n<=100, seq[n]==seq[n-1]+2**(n-2)") """ url = "https://web-mcp.ziziyi.com/logic/solve" r = httpx.post(url, json={"formula": formula}, timeout=10) return r.json()["result"] ### 云端 MCP:绘图 def plot_line(seq: list[int]) -> str: """ 把序列画成折线图,返回 png 直链 """ url = "https://web-mcp.ziziyi.com/plot/line" r = httpx.post(url, json={"sequence": seq}, timeout=10) return r.json()["image_url"]