From 728490557bac8e3ac446f51f56074d23abf44444 Mon Sep 17 00:00:00 2001 From: Lucas Carlson Date: Tue, 30 Dec 2025 19:27:47 -0800 Subject: [PATCH] fix(filesystem): correct outputSchema for directory_tree and move_file 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 #3093, Fixes #3106 --- src/filesystem/index.ts | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/filesystem/index.ts b/src/filesystem/index.ts index 48a599fae1..edc5749f9b 100644 --- a/src/filesystem/index.ts +++ b/src/filesystem/index.ts @@ -518,7 +518,12 @@ server.registerTool( path: z.string(), excludePatterns: z.array(z.string()).optional().default([]) }, - outputSchema: { content: z.string() }, + outputSchema: { + content: z.array(z.object({ + type: z.literal("text"), + text: z.string() + })) + }, annotations: { readOnlyHint: true } }, async (args: z.infer) => { @@ -588,7 +593,12 @@ server.registerTool( source: z.string(), destination: z.string() }, - outputSchema: { content: z.string() }, + outputSchema: { + content: z.array(z.object({ + type: z.literal("text"), + text: z.string() + })) + }, annotations: { readOnlyHint: false, idempotentHint: false, destructiveHint: false } }, async (args: z.infer) => {