Skip to content

Commit e58b915

Browse files
committed
fix: pass updatedInput in canUseTool allow response to satisfy SDK Zod schema
The SDK's runtime Zod validation requires updatedInput as a record on allow responses, even though TypeScript types mark it optional. Pass through the original tool input to satisfy the schema and actually allow MCP tool calls.
1 parent c91a8c7 commit e58b915

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

claude/client.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,10 +213,12 @@ export async function sendToClaudeCode(
213213
// The dontAsk permission mode blocks MCP tools because they aren't "pre-approved".
214214
// canUseTool handles permission prompts — built-in tools that dontAsk
215215
// auto-approves (Read, Edit, Bash, etc.) won't trigger this callback.
216+
// NOTE: The SDK's runtime Zod schema requires `updatedInput` on allow responses
217+
// even though the TypeScript types mark it optional — pass through original input.
216218
...(mcpToolPrefixes.length > 0 && {
217-
canUseTool: async (toolName: string) => {
219+
canUseTool: async (toolName: string, input: Record<string, unknown>) => {
218220
if (mcpToolPrefixes.some(prefix => toolName.startsWith(prefix))) {
219-
return { behavior: 'allow' as const };
221+
return { behavior: 'allow' as const, updatedInput: input };
220222
}
221223
return { behavior: 'deny' as const, message: `Tool ${toolName} not pre-approved` };
222224
},

0 commit comments

Comments
 (0)