Checks
Strands Version
1.19.0
Python Version
3.11.9
Operating System
macos 14.6.1
Installation Method
other
Steps to Reproduce
Bedrock/Claude model sends nested object parameters as JSON string instead of dict
Description
When using strands with MCP tools that have nested object parameters (e.g., parameters: dict), the Bedrock/Claude model incorrectly serializes the parameter value as a JSON string instead of passing it as a native Python dictionary.
This issue does not occur with the Gemini model, which correctly passes nested objects as dictionaries.
Environment
- strands version: 1.19.0
- fastmcp version: 2.13.2 / 2.13.3
- Python version: 3.11 / 3.12
- Model (problematic):
us.anthropic.claude-sonnet-4-20250514-v1:0 (Bedrock) & other claude model versions
- "arn:aws:bedrock:us-east-2::inference-profile/global.anthropic.claude-opus-4-5-20251101-v1:0"
- ... other claude models
- Model (working):
gemini-2.5-flash (Google AI)
Tool Schema (from MCP Server)
{
"name": "ecs_troubleshooting_tool",
"inputSchema": {
"properties": {
"action": {
"type": "string",
"enum": ["fetch_service_events", "fetch_task_failures", "..."]
},
"parameters": {
"anyOf": [
{ "additionalProperties": true, "type": "object" },
{ "type": "null" }
],
"default": null
}
},
"type": "object"
}
}
Expected Behavior
The parameters argument should be passed as a Python dictionary:
ecs_troubleshooting_tool(
action="fetch_service_events",
parameters={
"ecs_cluster_name": "my-cluster",
"ecs_service_name": "my-service",
"time_window": 3600
}
)
Actual Behavior (Bedrock/Claude)
The parameters value is serialized as a JSON string:
ecs_troubleshooting_tool(
action="fetch_service_events",
parameters='{"ecs_cluster_name": "my-cluster", "ecs_service_name": "my-service", "time_window": 3600}'
)
This causes a Pydantic validation error:
ValidationError: 1 validation error for call[mcp_ecs_troubleshooting_tool]
parameters
Input should be a valid dictionary [type=dict_type, input_value='{"ecs_cluster_name": "in...dol-test-vcs-use2-dev"}', input_type=str]
Tool #5: ecs_troubleshooting_tool
[12/04/25 13:18:48] Error validating tool 'ecs_troubleshooting_tool': 1 validation error for call[mcp_ecs_troubleshooting_tool]
parameters
Input should be a valid dictionary [type=dict_type, input_value='{"ecs_cluster_name": "in...", "time_window": 7200}', input_type=str]
For further information visit https://errors.pydantic.dev/2.12/v/dict_type
╭───────────────────────────────────────────────────────────────────────── Traceback (most recent call last) ─────────────────────────────────────────────────────────────────────────╮
│ /Users/a18144/.cache/uv/archive-v0/JtV7en25lIaDnPI8k48sK/lib/python3.11/site-packages/fastmcp/tools/tool_manager.py:160 in call_tool │
│ │
│ /Users/a18144/.cache/uv/archive-v0/JtV7en25lIaDnPI8k48sK/lib/python3.11/site-packages/fastmcp/tools/tool.py:341 in run │
│ │
│ /Users/a18144/.cache/uv/archive-v0/JtV7en25lIaDnPI8k48sK/lib/python3.11/site-packages/pydantic/type_adapter.py:441 in validate_python │
╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
ValidationError: 1 validation error for call[mcp_ecs_troubleshooting_tool]
parameters
Input should be a valid dictionary [type=dict_type, input_value='{"ecs_cluster_name": "in...", "time_window": 7200}', input_type=str]
Steps to Reproduce
- Create an MCP tool with a nested object parameter (e.g.,
parameters: dict | None)
- Use strands with
BedrockModel (Claude)
- Have the agent call the tool with nested parameters
- Observe the validation error
Workaround
Switching to Gemini model resolves the issue, as Gemini correctly passes nested objects as dictionaries.
What I've Tried
- Prompt engineering to instruct the model to "pass parameters as an object, not a string" — did not work
Possible Root Causes
-
BedrockModel response parsing: The tool call arguments from Bedrock Converse API may be returned as a JSON-encoded string, and strands doesn't deserialize nested objects.
-
Schema interpretation: Claude may interpret type: "object" differently and choose to stringify nested structures.
-
strands tool invocation: The library may not handle the case where nested parameters need to be parsed from JSON strings.
Potentially Related Files
strands/models/bedrock.py — BedrockModel implementation
strands/event_loop/ — Tool execution logic
Expected Behavior
..
Actual Behavior
..
Additional Context
No response
Possible Solution
No response
Related Issues
No response
Checks
Strands Version
1.19.0
Python Version
3.11.9
Operating System
macos 14.6.1
Installation Method
other
Steps to Reproduce
Bedrock/Claude model sends nested object parameters as JSON string instead of dict
Description
When using strands with MCP tools that have nested object parameters (e.g.,
parameters: dict), the Bedrock/Claude model incorrectly serializes the parameter value as a JSON string instead of passing it as a native Python dictionary.This issue does not occur with the Gemini model, which correctly passes nested objects as dictionaries.
Environment
us.anthropic.claude-sonnet-4-20250514-v1:0(Bedrock) & other claude model versionsgemini-2.5-flash(Google AI)Tool Schema (from MCP Server)
{ "name": "ecs_troubleshooting_tool", "inputSchema": { "properties": { "action": { "type": "string", "enum": ["fetch_service_events", "fetch_task_failures", "..."] }, "parameters": { "anyOf": [ { "additionalProperties": true, "type": "object" }, { "type": "null" } ], "default": null } }, "type": "object" } }Expected Behavior
The
parametersargument should be passed as a Python dictionary:Actual Behavior (Bedrock/Claude)
The
parametersvalue is serialized as a JSON string:This causes a Pydantic validation error:
Steps to Reproduce
parameters: dict | None)BedrockModel(Claude)Workaround
Switching to Gemini model resolves the issue, as Gemini correctly passes nested objects as dictionaries.
What I've Tried
Possible Root Causes
BedrockModel response parsing: The tool call arguments from Bedrock Converse API may be returned as a JSON-encoded string, and strands doesn't deserialize nested objects.
Schema interpretation: Claude may interpret
type: "object"differently and choose to stringify nested structures.strands tool invocation: The library may not handle the case where nested parameters need to be parsed from JSON strings.
Potentially Related Files
strands/models/bedrock.py— BedrockModel implementationstrands/event_loop/— Tool execution logicExpected Behavior
..
Actual Behavior
..
Additional Context
No response
Possible Solution
No response
Related Issues
No response