Repository navigation
feat(mcp): declare title and tool annotations - #687
Merged
Merged
Conversation
Tools, resources and prompts accept an optional top-level `title` (1-256 chars); tools accept optional `annotations` closed to the four boolean MCP behavior hints. Both are echoed in tools/list, resources/list and prompts/list and omitted when absent. Unknown hints, non-boolean values and `title` inside annotations fail validation. Co-Authored-By: Claude Opus 5.5 <[email protected]>
jimhoyd
force-pushed
the
feat/mcp-tool-title-annotations
branch
from
September 24, 2026 20:17
5598e39 to
9d81482
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #677
What changed
packages/mcp/src/mcp.ts: optional top-leveltitle(string, 1–256 chars) on the tool, resource and prompt config schemas and onMcpToolSpec/McpResourceSpec/McpPromptSpec. Optional tool-onlyannotations, a closed object (additionalProperties: false) with the four boolean hintsreadOnlyHint,destructiveHint,idempotentHint,openWorldHint(new exportedMcpToolAnnotationstype). Notitleinsideannotations.tools/list,resources/listandprompts/listecho these fields and leave out any that are absent. The shape matches theannotationsobject core's own MCP server (packages/core/src/mcp.ts) already emits.mcpAuthoringdescription now mentionstitleandannotations.packages/mcp/urlcode.jsonwas regenerated withnpm run build:addonsbecause it embeds the schema.packages/mcp/README.md(YAML example, a field explanation stating the hints are advisory and never enforced, the list of what is implemented),packages/mcp/llms.txt(field list) andpackages/mcp/CHANGELOG.md(Unreleased).docs/EXTENSIONS.mdanddocs/FRAMEWORK.mddescribe mcp without listing fields, so they needed no edit.The diff stays inside the schemas, spec types, list responses and authoring text.
handle()is untouched, which keeps this PR clear of the concurrent Origin/protocol-version work.Evidence
npm run typecheck: exit 0packages/mcpnpm run verify: 22/22 tests pass, 2 of them new:titleinside annotations, an empty title and a 257-char title. A control declaration carrying every valid hint and a title starts successfully, so each refusal comes from the one bad field.npm run verify: exit 0, all suites pass (781, 22, 35, 95, 220, 14, 65, 3). The first run failed only becausepackages/mcp/urlcode.jsonwas stale, and regenerating it fixed that.Limitations
Invalid extension configuration: mcpwithout naming the field, so the refusal tests check that message and rely on the control case to show which field caused the refusal.🤖 Generated with Claude Code