A new kind of package: an OpenCode plugin whose only hook is `tool`,
which magpie serves to every agent on /mcp/magpie/tools. Three tools:
eval (exact rational arithmetic in BigInt fractions), convert (data,
time, length, CSS, mass, angle, temperature) and date (calendar-aware
add, between, weekday/ISO week, IANA zones through Intl, DST included).
No network, no key, no dependency.
Run:
- bun test packages/calc: 8 tests, 73 expects, pass with TZ=UTC and
TZ=Pacific/Kiritimati.
- A sandbox magpie built from yetone/magpie origin/main b03031738
(nogui, HOME in a scratch dir, gateway on 127.0.0.1:3591):
`magpie plugin add <folder>`; `magpie plugin` lists
"tools calc_convert, calc_date, calc_eval". Over /mcp/magpie/tools:
initialize, tools/list (3 tools with their schemas), tools/call
calc_eval 0.1+0.2 -> {"exact":"3/10","decimal":"0.3"}, 1/0 -> isError
"division by zero", calc_convert 1 GiB->MB -> 16777216/15625
(1073.741824), calc_date across New York's DST with `to` -> between.
Not tried: an npm install. From npm the tools are named tools-calc_*,
since magpie's ShortName doesn't strip "tools-".
12 lines
560 B
JSON
12 lines
560 B
JSON
{
|
|
"name": "@magpie-community/tools-calc",
|
|
"version": "0.1.0",
|
|
"description": "Exact arithmetic, unit conversion and calendar date math as tools for every coding agent, through magpie's MCP server",
|
|
"type": "module",
|
|
"main": "./index.mjs",
|
|
"files": ["index.mjs", "calc.mjs", "README.md"],
|
|
"keywords": ["magpie", "magpie-tools", "mcp", "opencode", "opencode-plugin", "calculator", "units", "dates"],
|
|
"license": "MIT",
|
|
"repository": { "type": "git", "url": "git+https://github.com/magpie-community/plugins.git", "directory": "packages/calc" }
|
|
}
|