Skip to content

Conversation

@cardmagic
Copy link

Summary

Fixes the outputSchema declarations for directory_tree and move_file tools to match their actual return types.

Both tools were declaring outputSchema: { content: z.string() } but returning { content: [{ type: "text", text: "..." }] } - an array of content blocks. This mismatch caused MCP validation error -32602 when clients used structured content validation.

Changes

  • Updated directory_tree outputSchema to declare content as array of text content blocks
  • Updated move_file outputSchema with the same fix

Test plan

  • Build passes (npm run build in src/filesystem)
  • Schema now matches the actual return type
  • Clients using structured content validation should no longer receive -32602 errors

Fixes #3093
Fixes #3106

Why this change was needed:
Both tools declared outputSchema as { content: z.string() } but their
handlers return { content: [{ type: "text", text: "..." }] } - an array
of content blocks. This mismatch caused MCP validation error -32602.

What changed:
- Updated directory_tree outputSchema to declare content as array of
  text content blocks
- Updated move_file outputSchema with the same fix
- Schema now matches the actual return type of both handlers

Problem solved:
Clients using structured content validation no longer receive -32602
errors when calling directory_tree or move_file tools.

Fixes modelcontextprotocol#3093, Fixes modelcontextprotocol#3106
@cardmagic cardmagic marked this pull request as draft December 31, 2025 03:30
@cardmagic
Copy link
Author

Closing this PR - after investigation, the issues #3093 and #3106 were already fixed in commit 968acc2 (PR #3113). The issues just need to be closed.

The existing tests in structured-content.test.ts fail on main because result.structuredContent is undefined - the MCP client SDK doesn't expose structuredContent in tool call results. This is a test infrastructure issue, not a code problem.

@cardmagic cardmagic closed this Dec 31, 2025
@cardmagic cardmagic deleted the fix/filesystem-output-schema-types branch December 31, 2025 03:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant