Skip to content

feat(time): add tool annotations#3581

Merged
olaservo merged 1 commit intomodelcontextprotocol:mainfrom
nielskaspers:fix/issue-3574-time-tool-annotations
Mar 15, 2026
Merged

feat(time): add tool annotations#3581
olaservo merged 1 commit intomodelcontextprotocol:mainfrom
nielskaspers:fix/issue-3574-time-tool-annotations

Conversation

@nielskaspers
Copy link
Contributor

Summary

Adds MCP ToolAnnotations to both tools in the time server (get_current_time and convert_time), marking them as read-only, non-destructive, idempotent, and closed-world — matching the annotation coverage already present in server-filesystem.

Issue

Fixes #3574

Changes

  • Import ToolAnnotations from mcp.types
  • Add annotations parameter to both Tool() declarations with readOnlyHint=True, destructiveHint=False, idempotentHint=True, openWorldHint=False

Testing

  • Metadata-only change; no behavioral impact
  • Both tools are pure computations (system clock read and timezone conversion) with no side effects or external calls

Copy link
Member

@olaservo olaservo left a comment

Choose a reason for hiding this comment

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

Both tool annotations are semantically correct:

  • get_current_time: reads the system clock — pure read-only, closed-world.
  • convert_time: timezone arithmetic using bundled zoneinfo data — pure computation, no external calls.

openWorldHint: false is correct for both (no network access). readOnlyHint: true is accurate.

Minor note: destructiveHint and idempotentHint are redundant when readOnlyHint is true per the MCP spec ("meaningful only when readOnlyHint == false"). The filesystem server omits them for its read-only tools. Not wrong to include them — just a style difference.

Also note: PR #3580 (fetch annotations) includes identical changes to this same time server file. If both merge, one will conflict. Recommend merging this PR first so #3580 can be scoped to fetch-only on rebase.

LGTM — thanks @nielskaspers!


Reviewed with the assistance of Claude Code (claude-opus-4-6). Annotation semantics verified against the MCP specification and time server source code.

@olaservo olaservo merged commit 81f8301 into modelcontextprotocol:main Mar 15, 2026
16 of 19 checks passed
nielskaspers added a commit to nielskaspers/servers that referenced this pull request Mar 15, 2026
…modelcontextprotocol#3574) (modelcontextprotocol#3581)

feat(time): add tool annotations

Adds MCP ToolAnnotations to both time server tools (get_current_time, convert_time). Both are read-only, non-destructive, idempotent, and closed-world.

Fixes modelcontextprotocol#3574
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.

Add tool annotations to server-time (2 tools, 0 annotated)

2 participants