fix(filesystem): return string in structuredContent to match outputSchema #3113
+161
−3
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Fixes the
MCP error -32602: Output validation errorthat occurs when usingdirectory_tree,move_file, andlist_directory_with_sizestools.Root cause: These three tools were returning
structuredContent: { content: [contentBlock] }(array) but theiroutputSchemadeclares{ content: z.string() }. This mismatch caused schema validation to fail.Fix: Changed
structuredContentfrom{ content: [contentBlock] }to{ content: text }to match the declaredoutputSchema, consistent with other working tools likelist_directoryandsearch_files.Server Details
directory_tree,move_file,list_directory_with_sizes)Motivation and Context
Multiple users reported MCP error -32602 when calling these tools. The error message indicated:
This was because
structuredContent.contentwas an array of content blocks instead of a string as declared inoutputSchema.How Has This Been Tested?
directory_treetool in Claude Code - no validation errorlist_directory_with_sizestool in Claude Code - no validation errormove_filetool in Claude Code - no validation errorBreaking Changes
None. The
contentfield (array of content blocks) remains unchanged for backwards compatibility. OnlystructuredContentis fixed to match the declared schema.Types of changes
Checklist
Additional context
Fixes #3110, #3106, #3093
🤖 Generated with Claude Code