Commit Graph
2 Commits
Author SHA1 Message Date
yetone 6a3fe9b49e calc: the tools are named calc_* from npm too (magpie v0.1.1260) 2026-10-16 03:41:45 +08:00
yetone bd6e1ed387 tools-calc 0.1.0: exact arithmetic, unit conversion and date math for every agent
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-".
2026-10-16 02:57:29 +08:00