Skip to content

fix: accept string booleans for guard approval parameter#71

Merged
matthiastjong merged 1 commit intomainfrom
fix/guard-approval-instructions
May 1, 2026
Merged

fix: accept string booleans for guard approval parameter#71
matthiastjong merged 1 commit intomainfrom
fix/guard-approval-instructions

Conversation

@matthiastjong
Copy link
Copy Markdown
Owner

Summary

  • String boolean coercion: Claude Code MCP clients sometimes serialize approved: true as approved: "true" (string). Added z.preprocess to accept both forms, fixing the invalid_type: expected boolean, received string error.
  • Better approval response: The request field now includes all original parameters (target, method, path, etc.) so the agent can easily reconstruct the re-call with approved: true.
  • Clearer next_action instructions: Explicitly tells the agent to re-call the SAME tool with all the SAME parameters plus approved: true.

Test plan

  • All 19 MCP integration tests pass
  • svelte-check passes with 0 errors

🤖 Generated with Claude Code

… instructions

Claude Code MCP clients sometimes serialize boolean parameters as strings,
causing `approved: "true"` to fail Zod validation. Use z.preprocess to
coerce string booleans.

Also improve the approval_required response:
- Include all original request parameters in the response so the agent
  can easily re-send the exact same call with approved: true
- Make next_action instructions more explicit about re-calling with
  all the same parameters

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@matthiastjong matthiastjong merged commit 5cc2e36 into main May 1, 2026
3 checks passed
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.

1 participant