Skip to content

feat(mcp): publish tool effect annotations in tools/list (#206) - #222

Closed
Agozie180 wants to merge 1 commit into
flop-labs:mainfrom
Agozie180:feat/mcp-tool-annotations
Closed

Agozie180 wants to merge 1 commit into
flop-labs:mainfrom
Agozie180:feat/mcp-tool-annotations

Conversation

@Agozie180

Copy link
Copy Markdown

What

Publishes standard MCP ToolAnnotations in the stdio server's tools/list (#206). Every tool now carries effect hints alongside its name/description/inputSchema:

  • Read-only (readOnlyHint, openWorldHint): read_room, wait_for_message, list_rooms, discover_rooms, read_note, list_notes, read_docs.
  • say: non-read-only, non-destructive (append), non-idempotent, open-world.
  • write_note: non-read-only, destructive (can overwrite durable, world-writable state), non-idempotent, open-world.

Every tool is openWorldHint because each reaches the configured external Technocore instance. The Tool/Server.tool representation gained an optional annotations argument; spec() emits the key only when set.

Why

Closes #206. Annotation-aware clients could not tell a read from a write without parsing prose, even though the distinction matters most here — say appends public data and write_note can overwrite durable state.

On the issue's open compatibility question (emit unconditionally vs. vary by negotiated protocol version): this emits unconditionally as additive metadata. Rationale —

  • The in-repo /humans WebMCP surface already emits annotations unconditionally per tool, so this matches existing precedent in the same codebase.
  • ToolAnnotations is additive; a 2024-11-05 client ignores the unknown key rather than failing.
  • Varying by version would require retaining per-connection negotiated-version state, which the module deliberately avoids — the issue itself flagged not adding that machinery without confirmation.

Orthogonal to #203 (which tightens inputSchema.additionalProperties); no handler or HTTP behavior changes.

Abuse: nothing new — no HTTP surface, route, parameter, or cap changes; this is read-only metadata in a local stdio wrapper.

Checks

  • ruff check . ✓ · ruff format --check . ✓ · ty check ✓
  • coverage run -m pytest tests -q: 383 passed, branch coverage 97.47% (fail_under=96) ✓
  • New regression test_tools_list_publishes_effect_annotations fails without the change (the spec has no annotations key → KeyError).
  • sz.py --check unaffected (mcp/ is outside the size gate).

Each tool now carries standard MCP ToolAnnotations (readOnlyHint,
openWorldHint, plus destructiveHint/idempotentHint on the two writes)
so an annotation-aware client can tell a read from a write without
parsing the description. Additive metadata emitted unconditionally;
older clients ignore the extra key.

sv commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Closing as delivered elsewhere — the feature shipped, this diff cannot.

#539 rebuilt the wrapper on the official MCP Python SDK and deleted mcp/src/technocore_mcp/protocol.py, which this PR patches, so there is nothing left to rebase onto. Every tool now publishes ToolAnnotations with the same matrix you proposed for #206 — seven read-only, say additive, write_note potentially destructive, all open-world — pinned in tests/test_mcp.py:289.

Thanks for working out the matrix; it is the one that shipped.


Generated by Claude Code

@sv sv closed this Aug 31, 2026
@Agozie180

Copy link
Copy Markdown
Author

Thanks for closing the loop. I checked #539 and the SDK-backed tool annotations cover the same effect matrix, with tests around the published metadata. There is nothing useful to carry forward from this old diff.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

mcp: expose tool effect annotations in tools/list

2 participants