mcpField
M
math-router

math-router

github.com/parcadei其他3.9k495 次安装39 周前更新
代码仓库

关于 math-router

Math Router 是面向数学请求的路由技能,通过模式匹配将意图转换为 CLI 命令,供需要运行数学计算脚本的用户使用。它支持多个数学类别,并可列出路由;无法识别时提示澄清或改用单项技能。

主要功能

  1. 01将数学意图路由到 CLI 命令
  2. 02按模式匹配提取参数
  3. 03支持多个数学类别的路由
  4. 04列出全部或分类路由
  5. 05提供未识别请求的回退方式

适用场景

  1. 01将积分请求转换为计算命令
  2. 02路由单位换算或几何操作
  3. 03查询可用数学命令

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/parcadei/continuous-claude-v3 --skill math-router

安装后在 Claude Code 中输入/math-router确认已加载。

详细介绍

Math Router

数学请求始终先使用此路由器。

无需阅读各个技能的文档,调用路由器即可获取确切命令:

使用方法

# Route any math intent to get the CLI command
uv run python scripts/cc_math/math_router.py route "<user's math request>"

示例工作流

  1. 用户说:“计算 sin(x) 从 0 到 pi 的积分”
  2. 你运行:uv run python scripts/cc_math/math_router.py route "integrate sin(x) from 0 to pi"
  3. 路由器返回:
    {
      "command": "uv run python scripts/cc_math/sympy_compute.py integrate \"sin(x)\" --var x --lower 0 --upper pi",
      "confidence": 0.95
    }
    
  4. 执行返回的命令
  5. 将结果返回给用户

为什么使用路由器

  • 更快:无需阅读技能文档
  • 确定性:基于模式,而非 LLM 推理
  • 准确:正确提取参数
  • 全面:涵盖 7 个脚本中的 32 条路由

可用路由

类别命令
sympyintegrate, diff, solve, simplify, limit, det, eigenvalues, inv, expand, factor, series, laplace, fourier
pintconvert, check
shapelycreate, measure, pred, op
z3prove, sat, optimize
scratchpadverify, explain
tutorhint, steps, generate
plotplot2d, plot3d, latex

列出所有命令

# List all available routes
uv run python scripts/cc_math/math_router.py list

# List routes by category
uv run python scripts/cc_math/math_router.py list --category sympy

备用方案

如果路由器返回 {"command": null},则表示未识别该意图。接下来:

  1. 请用户澄清
  2. 或使用单独的技能:/sympy-compute、/z3-solve、/pint-compute 等

评论

支持 Markdown