feat: advertise MCP tool annotations on every tool #2
No reviewers
Labels
No milestone
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
SquareCows/forgejo-mcp!2
Loading…
Reference in a new issue
No description provided.
Delete branch "paulgit/forgejo-mcp:feat/tool-annotations"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
All 457 Forgejo API tools and the lazy-mode
load_tool_areatool now advertiseMCP
ToolAnnotations(readOnlyHint, destructiveHint, idempotentHint,openWorldHint) on
tools/list. Clients can use these hints to gate permissionprompts, group read-only tools and auto-approve safe reads, instead of treating
every call as potentially destructive.
Changes
src/tools/helpers.ts: three explicit presets,READ_ONLY_TOOL(240 tools:all GET/getRaw tools plus the two read-only POST renderers),
ADDITIVE_TOOL(67 purely additive creations),DESTRUCTIVE_TOOL(150non-additive edits, replacements, merges, removals and commands).
src/tools/*.tsmodules: each registration passes its preset via theSDK's five-argument
server.tooloverload. Handlers, schemas and HTTP callsare unchanged.
src/server.ts:load_tool_areaannotated as a local session mutation(non-read-only, non-destructive, idempotent, closed-world).
destructiveHintis spec-strict (false only forpurely additive operations);
openWorldHintis true for every API tool;idempotentHintstays false for state-changing tools unless verified againstForgejo source. The one verified exception is
get_runner_registration_token(
GetOrCreateActiveRunnerTokenconverges on repeat).hints; representative tools pinned exactly; guard test ensures only the
verified exception claims idempotency.
future tools).
Verification
npm test: 349/349 across 14 files;npm run lint,npx tsc --noEmitandnpm run buildclean.missing annotations, 240 read-only / 67 additive / 150 destructive; lazy mode
loads with loader-only and loaded tools carry identical annotations.
Notes
safety control.
block_user/org_block_userare destructive because upstreamBlockUseralso unfollows, unstars, unwatches, unassigns, removescollaborations and cancels pending transfers in one transaction.
Thanks for this, changes are reviewed and merged and this will be released in v0.4.0