Ericwyn/cal-tool
3.2
If you are the rightful owner of cal-tool and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to dayong@mcphub.com.
A simple command-line tool for calculating mathematical expressions with support for MCP mode.
Tools
1
Resources
0
Prompts
0
Cal
一个简单的命令行工具,用于计算数学表达式
支持 mcp 模式
计算库依赖于
- github.com/dengsgo/math-engine
直接使用
- 直接计算表达式
# 直接计算表达式
cal 1+1
# 1+1 = 2
- 计算多个表达式
cal "1+2;3*4"
# 1+2 = 3
# 3*4 = 12
mcp 模式
使用以下 json 将 cal 作为 mcp server 导入到各种工具中
{
"mcpServers": {
"calculate-tool-mcp": {
"name": "calculate-tool-mcp",
"description": "math cal tool",
"command": "cal",
"args": ["-mcp"]
}
}
}
e.g: 在 cherry-studio 中导入
- 添加配置
- 导入成功
- 调用 mcp
支持的运算符号
ericwyn@ericwyn-ser:~$ cal symbol -h
support symbol and expressions:
| symbol | explanation | e.g. |
| ----------- | -------------------- | ------------------------------------- |
| `+` | plus | 1+2 = 3 |
| `-` | sub | 8-3.5 = 4.5 |
| `*` | multiply | 2*3 = 6 |
| `/` | division | 5/2 = 2.5 |
| `%` | remainder | 5%2 = 1 |
| `^` | integer power | 2^3 = 8, 3^2 = 9 |
| `e` | E-notation | 1.2e3 = 1.2e+3 = 1200,1.2e-2 = 0.012 |
| `()` | brackets | (2+3)*4 = 20 |
| `_` | number separator | 123_456_789 = 123456789 |
| `pi` | π | pi = 3.141592653589793 |
| `sin(x)` | sine | sin(pi/2) = 1 |
| `cos(x)` | cosine | cos(0) = 1 |
| `tan(x)` | tangent | tan(pi/4) = 1 |
| `cot(x)` | cotangent | cot(pi/4) = 1 |
| `sec(x)` | secant | sec(0) = 1 |
| `csc(x)` | cosecant | csc(pi/2) = 1 |
| `abs(x)` | absolute value | abs(-6) = 6 |
| `ceil(x)` | ceil | ceil(4.2) = 5 |
| `floor(x)` | floor | floor(4.8) = 4 |
| `round(x)` | round | round(4.4) = 4, round(4.5) = 5 |
| `sqrt(x)` | square root | sqrt(4) = abs(sqrt(4)) = 2 |
| `cbrt(x)` | cube root | cbrt(27) = 3 |
完整参数
ericwyn@ericwyn-ser:~$ cal -h
Usage: cal <expression>
Example:
cal 1+1 --> Calculate a single expression
cal "1+2;3*4" --> use ; to split multiple expressions and calculate the results simultaneously
All supported symbols and expressions can show with:
cal symbol -h
MCP Mode:
The following JSON can be used among various tools to import MCP calculation tools
{
"mcpServers": {
"calculate-tool-mcp": {
"name": "calculate-tool-mcp",
"description": "math calculate tool",
"command": "cal",
"args": ["-mcp"]
}
}
}