Skip to content

feat(filesystem): add idempotentHint and openWorldHint annotations#3875

Open
ykshah1309 wants to merge 1 commit into
modelcontextprotocol:mainfrom
ykshah1309:feat/filesystem-annotation-hints
Open

feat(filesystem): add idempotentHint and openWorldHint annotations#3875
ykshah1309 wants to merge 1 commit into
modelcontextprotocol:mainfrom
ykshah1309:feat/filesystem-annotation-hints

Conversation

@ykshah1309

Copy link
Copy Markdown
Contributor

Summary

Adds idempotentHint and openWorldHint to tool annotations in server-filesystem, completing the annotation coverage for all four standard MCP hints.

Closes #3402

Changes

  • Add idempotentHint: true to 10 read-only tools — reads are inherently safe to retry and produce identical results
  • Add openWorldHint: false to all 14 tools — every operation is scoped to allowed directories with no network access or external side effects

Testing

Metadata-only change with no behavioral impact.

  • npm run build --workspace=src/filesystem compiles cleanly
  • npm test --workspace=src/filesystem — all 146 tests pass

Add idempotentHint: true to all 10 read-only tools (reads are inherently
safe to retry) and openWorldHint: false to all 14 tools (all operations
are scoped to allowed directories with no external side effects).

Closes modelcontextprotocol#3402
@cliffhall cliffhall added enhancement New feature or request server-filesystem Reference implementation for the Filesystem MCP server - src/filesystem labels Apr 20, 2026
@cliffhall

Copy link
Copy Markdown
Member

@claude review

@claude

claude Bot commented Apr 21, 2026

Copy link
Copy Markdown
Contributor

Claude finished @cliffhall's task in 1m 31s —— View job


PR Review

  • Read the changed file and git diff
  • Check MCP spec compliance for annotation values
  • Verify annotation assignments match tool semantics
  • Post review feedback

Overall: Clean, correct, and spec-compliant. This PR completes annotation coverage for the filesystem server with well-reasoned values.

openWorldHint: false — All 14 tools

Correct across the board. Every tool in this server operates exclusively on the local filesystem within allowed directories — no network calls, no external services. The MCP spec default is true (open world assumed), so explicitly declaring false is a meaningful and accurate signal to clients.

idempotentHint: true — 10 read-only tools

Correct. None of these reads mutate environment state, so calling them repeatedly with the same arguments has no additional effect.

One minor note: the MCP spec states that readOnlyHint: true implies idempotentHint: true, making the explicit setting technically redundant. However, being explicit is a defensible style choice — it makes the intent unambiguous and doesn't violate the spec. No action required.

Pre-existing write-tool annotations (unchanged by this PR, but worth validating)

Tool idempotentHint destructiveHint Assessment
write_file true true ✓ Overwrites idempotently; destructive because prior content is lost
edit_file false true ✓ Applying the same edit twice yields different results
create_directory true false mkdir -p is idempotent; no destruction
move_file false true ✓ Second call with same args fails (destination exists); not idempotent

All pre-existing values hold up under scrutiny.

Suggestion: list_allowed_directories and dynamic Roots

list_allowed_directories returns the server's current allowed directories, which can change at runtime via MCP Roots updates. This doesn't affect the correctness of idempotentHint: true (the hint is about side effects, not result consistency), but it's worth knowing. No change needed.

Verdict

No issues found. The annotations are accurate and the PR description matches the diff exactly (10 read-only tools get idempotentHint, all 14 get openWorldHint: false). Ready to merge.

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

Labels

enhancement New feature or request server-filesystem Reference implementation for the Filesystem MCP server - src/filesystem

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add missing idempotentHint and openWorldHint to server-filesystem

2 participants