Skip to content

fix(filesystem): move_file outputSchema returns array not string#3776

Open
haroldfabla2-hue wants to merge 1 commit intomodelcontextprotocol:mainfrom
haroldfabla2-hue:fix-move-file-output-schema
Open

fix(filesystem): move_file outputSchema returns array not string#3776
haroldfabla2-hue wants to merge 1 commit intomodelcontextprotocol:mainfrom
haroldfabla2-hue:fix-move-file-output-schema

Conversation

@haroldfabla2-hue
Copy link
Copy Markdown

Summary

Fixes #3093

Problem

The move_file tool's outputSchema incorrectly declares content: z.string() but the handler returns content: [contentBlock] (an array). This mismatch causes MCP protocol validation to fail with error -32602:

Output validation error: Invalid structured content for tool move_file:
  expected string, received array

Fix

Changed outputSchema from:

outputSchema: { content: z.string() }

to:

outputSchema: { content: z.array(z.object({ type: z.string(), text: z.string() })) }

This matches the actual return value:

return {
  content: [contentBlock],  // array of {type: 'text', text: string}
  structuredContent: { content: text }
};

Testing

The bug was reported by a user on Windows 10 with Claude Desktop 1.0.130.7 and @modelcontextprotocol/server-filesystem@latest. The fix aligns the schema declaration with the actual runtime behavior.

Fixes modelcontextprotocol#3093 - move_file tool returns array instead of string (Error -32602)

The outputSchema declared content as z.string() but the handler
returns content: [contentBlock] where contentBlock is an object.
This mismatch causes MCP protocol validation to fail with:
  'Invalid structured content for tool move_file:
   expected string, received array'

The outputSchema now correctly declares content as an array
of text content blocks, matching the actual return value.
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.

Filesystem MCP: move_file tool returns array instead of string (Error -32602)

1 participant