Fix: Only include updatedInput when explicitly provided in permission callbacks #329
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.
Summary
Fixes #1063 - MCP Tools receive empty arguments when using permission approval flow
Problem
When a permission callback returns
PermissionResultAllow()without theupdated_inputparameter, the SDK incorrectly includes"updatedInput": {}in the control_response. This causes Claude CLI to discard the original tool arguments and use an empty object instead, breaking all multi-parameter MCP tools.Root Cause
In
query.py:238-242, the SDK always includedupdatedInputin the response:This meant
updatedInputwas always present, even when the user didn't set it.Solution
Only include
updatedInputin the control_response when explicitly provided:Changes
updatedInputupdatedInputis omitted when not providedTesting
Before & After
Before (buggy):
{ "type": "control_response", "response": { "behavior": "allow", "updatedInput": {} // Always included, overwrites arguments } }After (fixed):
{ "type": "control_response", "response": { "behavior": "allow" // updatedInput only included when explicitly set } }Impact