feat: 添加云端 MCP 功能和相关数据
- 新增 111.json 和 222.json 文件,包含 lottery 数据 - 添加 custom_functions.py 文件,实现云端 MCP 功能 - 序列生成和预测 -逻辑验证 - 绘图功能 - 创建 mcp.json 文件,配置 MCP 服务器
This commit is contained in:
38
.roo/custom_functions.py
Normal file
38
.roo/custom_functions.py
Normal file
@@ -0,0 +1,38 @@
|
||||
### 云端 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"]
|
||||
Reference in New Issue
Block a user