Skip to content

feat(everything): add tool-level annotations to get-annotated-message#3246

Open
olaservo wants to merge 8 commits intomodelcontextprotocol:mainfrom
olaservo:fix/tool-annotations
Open

feat(everything): add tool-level annotations to get-annotated-message#3246
olaservo wants to merge 8 commits intomodelcontextprotocol:mainfrom
olaservo:fix/tool-annotations

Conversation

@olaservo
Copy link
Member

@olaservo olaservo commented Jan 24, 2026

Description

Add ToolAnnotations to all 18 tools in the Everything example server. Previously only get-annotated-message had annotations; now every tool explicitly declares readOnlyHint, destructiveHint, idempotentHint, and openWorldHint so the server serves as a complete reference for developers implementing tool annotations per the MCP spec.

Server Details

  • Server: everything
  • Changes to: tools, docs

Motivation and Context

Tool annotations are part of the MCP specification and provide hints to clients about tool behavior:

Annotation Purpose
readOnlyHint Indicates the tool does not modify its environment
destructiveHint Indicates whether the tool may perform destructive updates
idempotentHint Indicates whether repeated calls with same args have no additional effect
openWorldHint Indicates whether the tool interacts with external entities

The Everything server is the canonical MCP reference/demo server, yet only 1 of its 18 tools had ToolAnnotations. Adding annotations to all tools makes it a complete reference for:

  • Client developers testing annotation support
  • Server developers learning proper tool annotation usage
  • Integration testing of annotation handling

Tool Annotations Added

Tool readOnlyHint destructiveHint idempotentHint openWorldHint Rationale
echo true false true false Pure function, echoes input back
get-annotated-message true false true false (already existed) Returns annotated messages
get-env true false true false Reads process.env, no modifications
get-resource-links true false true false Returns links to internal resources
get-resource-reference true false true false Returns internal resource references
get-roots-list true false true false Reads client roots, no modifications
get-structured-content true false true false Returns simulated weather data
get-sum true false true false Pure arithmetic computation
get-tiny-image true false true false Returns a static encoded image
trigger-long-running-operation true false true false Simulates work with progress, no lasting state change
toggle-simulated-logging false false false false Toggles server-side logging state (not idempotent)
toggle-subscriber-updates false false false false Toggles resource subscription updates (not idempotent)
trigger-elicitation-request false false false false Triggers user-facing dialog via client
trigger-elicitation-request-async false false false false Async task-based elicitation via client
trigger-sampling-request false false false true Triggers LLM inference (external API)
trigger-sampling-request-async false false false true Async task-based LLM inference (external API)
gzip-file-as-resource false false true true Fetches URLs and creates session resources; same input produces same output
simulate-research-query false false false false Creates background tasks with internal state

How Has This Been Tested?

  • TypeScript compilation passes (npm run build)
  • Verified annotations are accepted by SDK types with no type errors
  • Tested with MCP Inspector to confirm annotations appear in tools/list responses

Tested with this version of Inspector in this open PR: modelcontextprotocol/inspector#1066

Breaking Changes

None. Annotations are optional metadata hints and do not affect tool behavior.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Protocol Documentation
  • My changes follows MCP security best practices
  • I have updated the documentation accordingly
  • I have tested this with an LLM client
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have documented all environment variables and configuration options

Additional context

The annotation values follow the MCP spec semantics:

  • readOnlyHint: true when the tool only returns data with no side effects
  • destructiveHint: false for all tools since none delete or overwrite external data
  • idempotentHint: true when repeated calls with the same args produce the same result and no additional environmental effect; false for toggles, user-interactive tools, and task-creating tools
  • openWorldHint: true only for tools that interact with external systems (URL fetching, LLM sampling); false for tools operating within the closed MCP server/client domain

olaservo and others added 2 commits January 12, 2026 07:48
Add readOnlyHint, destructiveHint, idempotentHint, and openWorldHint
annotations to the tool config. Update docs to reflect that this tool
now demonstrates both tool-level and content annotations.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@olaservo olaservo marked this pull request as ready for review January 25, 2026 23:00
olaservo and others added 4 commits January 27, 2026 05:08
Previously only get-annotated-message had ToolAnnotations. Now all 18
tools explicitly declare readOnlyHint, destructiveHint, idempotentHint,
and openWorldHint so the server serves as a complete reference for
developers implementing tool annotations per the MCP spec.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
olaservo and others added 2 commits February 7, 2026 17:32
- Update get-annotated-message description: all tools now have
  tool-level annotations, not just this one
- Add missing tool entries: simulate-research-query,
  trigger-elicitation-request-async, trigger-sampling-request-async
- Add these tools to the file tree listing

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@olaservo olaservo marked this pull request as ready for review February 8, 2026 01:09
│ ├── get-sum.ts
│ ├── get-tiny-image.ts
│ ├── gzip-file-as-resource.ts
│ ├── simulate-research-query.ts
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unrelated updates - these were just missing from the docs.

@olaservo olaservo requested a review from cliffhall February 8, 2026 01:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant