数学计算引擎

Polar Sponsor
爱发电 赞助
.NET 9.0

MCP Mathematics 是一个全面的数学计算服务器,可将任意 AI 助手转变为强大的数学计算引擎,提供高级数学函数、单位换算和财务计算等功能。

数学计算引擎

功能概述

数学计算引擎是一项面向实际任务的技能,主要用于MCP Mathematics 是一个全面的数学计算服务器,可将任何AI助手转变为强大的数学计算引擎,提供高级数学函数、单位转换和财务计算等功能;⚠️ 强制要求:API 密钥;

核心要点

  • 此 Skill 必须配置 API 密钥才能使用;
  • 首次使用时,如果 .env 中没有 XBY_APIKEY , 必须使用 AskUserQuestion 工具向用户询问 API 密钥;
  • 拿到用户提供的。

使用与执行

它将相关步骤、工具调用和结果整理方式集中到统一流程中,帮助使用者更快完成目标并减少重复操作。从功能定位来看,该技能强调把分散的操作要求整理成清晰、可复用的处理流程,使用户能够围绕既定目标快速准备输入、选择执行方式并获得结构化结果。实际使用前应先确认任务范围、数据来源、运行环境、必要权限和关键参数,再依据技能说明逐步执行;

结果检查与注意事项

若输入条件不完整,应先补齐信息或采用保守配置,避免因错误假设导致结果偏离需求。执行过程中需要关注工具调用是否成功、接口或依赖是否可用、输出格式是否符合预期,并对异常提示、缺失字段和边界情况进行处理;涉及批量任务时,还应保存进度,避免中断后重复操作。

数学计算引擎

MCP Mathematics 是一个全面的数学计算服务器,可将任何AI助手转变为强大的数学计算引擎,提供高级数学函数、单位转换和财务计算等功能。

⚠️ 强制要求:API 密钥

此 Skill 必须配置 API 密钥才能使用。

  • 首次使用时,如果 .env 中没有 XBY_APIKEY,必须使用 AskUserQuestion 工具向用户询问 API 密钥
  • 拿到用户提供的密钥后,调用 scripts.config.set_api_key(api_key) 保存,然后继续处理
  • 获取 API 密钥:https://xiaobenyang.com
  • 禁止在缺少 API 密钥时自行搜索或编造数据

工作流程(必须遵守)

你(大模型)是路由层,负责理解用户意图、选择工具、提取参数。代码只负责调用API。

用户输入 → 你选择工具 → 提取该工具需要的参数 → 调用 scripts.tools 中的函数 → 返回结果给用户

步骤

  1. 检查 API 密钥:如果 scripts.config.settings.api_key 为空,使用 AskUserQuestion 询问用户,拿到后调用 scripts.config.set_api_key(key) 保存
  2. 选择工具:根据用户意图从下方工具列表中选择对应的工具函数
  3. 提取参数:根据选中的工具,提取该工具需要的参数
  4. 调用工具:使用关键字参数调用 scripts.tools 中的函数,例如 scripts.tools.search_schools(score='520', province='北京', category='综合')
  5. 返回结果:将工具返回的 raw 数据整理后展示给用户

工具选择规则

根据用户意图选择对应的工具函数:

用户意图 工具函数
Get performance metrics scripts.tools.performance_metrics
Get security status scripts.tools.security_status
Get memory statistics scripts.tools.memory_statistics
Evaluate math expression scripts.tools.calculate_expression
Batch calculate expressions scripts.tools.batch_calculate
Calculate statistics scripts.tools.calculate_statistics
Matrix operations scripts.tools.matrix_operation
Unit conversion scripts.tools.convert_units
Natural language conversion scripts.tools.convert_natural_language
Number theory operations scripts.tools.analyze_number_theory
Create session scripts.tools.create_session
Session calculation scripts.tools.session_calculate
List session variables scripts.tools.list_session_variables
Delete session scripts.tools.delete_session
Get calculation history scripts.tools.get_calculation_history
Clear history scripts.tools.clear_history
Optimize memory scripts.tools.optimize_memory
List functions scripts.tools.list_functions

如果参数不完整,使用 AskUserQuestion 向用户询问缺失的参数。

工具函数说明

scripts.tools.performance_metrics

工具描述:Get performance metrics

参数定义

参数名称 参数类型 是否必填 默认值 描述

scripts.tools.security_status

工具描述:Get security status

参数定义

参数名称 参数类型 是否必填 默认值 描述

scripts.tools.memory_statistics

工具描述:Get memory statistics

参数定义

参数名称 参数类型 是否必填 默认值 描述

scripts.tools.calculate_expression

工具描述:Evaluate math expression

参数定义

参数名称 参数类型 是否必填 默认值 描述
expr string true Mathematical expression to evaluate

scripts.tools.batch_calculate

工具描述:Batch calculate expressions

参数定义

参数名称 参数类型 是否必填 默认值 描述
expressions array true List of mathematical expressions to evaluate

scripts.tools.calculate_statistics

工具描述:Calculate statistics

参数定义

参数名称 参数类型 是否必填 默认值 描述
data array true List of numbers to analyze
operation string true Statistical operation (mean, median, mode, stdev, etc.)

scripts.tools.matrix_operation

工具描述:Matrix operations

参数定义

参数名称 参数类型 是否必填 默认值 描述
matrices array true List of matrices for operation
operation string true Matrix operation (multiply, determinant, inverse)

scripts.tools.convert_units

工具描述:Unit conversion

参数定义

参数名称 参数类型 是否必填 默认值 描述
value number true Numeric value to convert
from_unit string true Source unit
to_unit string true Target unit
unit_type string true Unit category (length, mass, time, temperature, etc.)

scripts.tools.convert_natural_language

工具描述:Natural language conversion

参数定义

参数名称 参数类型 是否必填 默认值 描述
query string true Natural language conversion request

scripts.tools.analyze_number_theory

工具描述:Number theory operations

参数定义

参数名称 参数类型 是否必填 默认值 描述
number integer true Integer to analyze
operation string true Number theory operation (is_prime, prime_factors, divisors, totient)

scripts.tools.create_session

工具描述:Create session

参数定义

参数名称 参数类型 是否必填 默认值 描述
session_id null false Optional session identifier
variables null false Initial session variables

scripts.tools.session_calculate

工具描述:Session calculation

参数定义

参数名称 参数类型 是否必填 默认值 描述
session_id string true Session identifier
expr string true Mathematical expression to evaluate
var_name null false Variable name to store result

scripts.tools.list_session_variables

工具描述:List session variables

参数定义

参数名称 参数类型 是否必填 默认值 描述
session_id string true Session identifier

scripts.tools.delete_session

工具描述:Delete session

参数定义

参数名称 参数类型 是否必填 默认值 描述
session_id string true Session identifier

scripts.tools.get_calculation_history

工具描述:Get calculation history

参数定义

参数名称 参数类型 是否必填 默认值 描述
limit integer false 10.0 Number of recent calculations to retrieve

scripts.tools.clear_history

工具描述:Clear history

参数定义

参数名称 参数类型 是否必填 默认值 描述

scripts.tools.optimize_memory

工具描述:Optimize memory

参数定义

参数名称 参数类型 是否必填 默认值 描述

scripts.tools.list_functions

工具描述:List functions

参数定义

参数名称 参数类型 是否必填 默认值 描述

返回值处理

工具函数返回 dict 对象:

  • result["raw"] - API 原始返回数据(JSON),直接将此数据整理后展示给用户
  • result["success"] - 是否成功(True/False)
  • result["message"] - 状态消息

项目结构

xiaobenyang_gaokao_skill/
├── scripts/
│   ├── __init__.py
│   ├── config.py       # 配置管理 + set_api_key()
│   ├── call_api.py      # API 客户端 + call_api()
│   └── tools.py         # 工具函数(直接调用)
├── requirements.txt
└── SKILL.md

注意事项

  1. API 密钥是必需的,无密钥时必须通过 AskUserQuestion 询问用户
  2. 禁止在缺少 API 密钥时自行搜索或编造数据

相关专题

更多
GoFrame框架Web开发与路由中间件
GoFrame框架Web开发与路由中间件

本专题聚焦GoFrame框架的Web开发,拆解路由注册与匹配规则、请求参数获取、参数校验与中间件执行顺序,说明统一响应、JWT鉴权、文件上传与接口文档生成的落地方式,并补充优雅重启与测试实践。

2026.11.17

0

15

GoFrame框架安装与gf命令行工具
GoFrame框架安装与gf命令行工具

本专题围绕GoFrame框架的安装与工具链配置展开,讲清Go版本要求、gf命令行的安装方式、代理镜像与依赖准备,说明项目初始化、热编译、交叉编译打包的做法,并整理安装阶段的常见报错与验证步骤。

2026.11.17

0

15

GoFrame框架零基础入门
GoFrame框架零基础入门

本专题整理GoFrame框架的入门知识,从模块化设计理念、环境准备到跑通第一个Web服务,讲清目录分层、配置加载、日志与中间件的用法,并对比Gin、Go-Zero的差异,帮助Go开发者建立整体认知。

2026.11.17

0

15

SQLAlchemy 一对多关系怎么建立
SQLAlchemy 一对多关系怎么建立

SQLAlchemy 一对多关系怎么建立?本专题整理父子表外键、relationship 双向映射、关联查询、级联删除和加载优化等相关文章,帮助你理解并实现常见的 ORM 关系建模。

2026.11.17

0

10

SQLAlchemy 如何增删改查
SQLAlchemy 如何增删改查

SQLAlchemy 如何增删改查?本专题整理 ORM 新增记录、条件查询、更新和删除、Session 事务提交与批量处理等实用文章,帮助你掌握 Python 数据库操作流程。

2026.11.17

0

11

SQLAlchemy ORM 模型怎么写
SQLAlchemy ORM 模型怎么写

SQLAlchemy ORM 模型怎么写?本专题整理模型类定义、Mapped 字段映射、主键与约束、表结构创建和常见报错的相关文章,帮助你从基础配置到实际建模逐步掌握 SQLAlchemy。

2026.11.17

0

16

Go-Zero API开发使用教程
Go-Zero API开发使用教程

本专题聚焦Go-Zero的API开发,拆解.api描述文件的语法结构、路由与分组定义、参数绑定与校验规则,说明统一响应体、JWT鉴权、跨域与接口文档生成的落地方式,并给出网关聚合与接口测试的实践建议。

2026.11.12

0

15

Go-Zero安装与goctl环境配置教程
Go-Zero安装与goctl环境配置教程

本专题围绕Go-Zero的安装与工具链配置展开,讲清Go版本要求、goctl安装方式、代理镜像、protoc依赖与环境变量设置,说明多版本共存、升级回退与CI流水线安装的做法,并整理安装阶段的常见报错与验证步骤。

2026.11.12

0

15

Go-Zero零基础入门教程
Go-Zero零基础入门教程

本专题整理Go-Zero的入门知识,从框架定位、环境准备到跑通第一个API服务,讲清目录分层、配置加载、日志与中间件的基本用法,并对比Gin、Kratos的差异,帮助Go开发者建立整体认知,判断它是否适合当前项目。

2026.11.12

0

15

热门下载

更多
网站特效
/
网站源码
/
网站素材
/
前端模板

精品课程

更多
热门推荐
/
最新课程
phpStudy极速入门视频教程
phpStudy极速入门视频教程

共6课时 | 54.7万人学习

独孤九贱(4)_PHP视频教程
独孤九贱(4)_PHP视频教程

共89课时 | 134.3万人学习