bedrock: Error when mcp tool is invoked without any arguments
Summary
I get an error when an MCP tool is invoked without any arguments.
Description
I'm using sonnet-3.7-thinking in Bedrock and a toy MCP server.
This MCP server has a single tool called get_random_article which fetches a random article from Wikipedia; the tool has an optional parameter for the locale which defaults to "en".
When the model invokes this tool without any arguments, I get the following error after the tool is invoked (i.e., when the model is called with the tool results):
Error interacting with language model
client error: DisplayErrorContext(ResponseError(ResponseError { source: ReceiverError { kind: UnexpectedEndOfStream }, raw: Invalid(Some(b"The value at messages.1.content.2.toolUse.input is empty.\"}")) }))
I did not have time to find a public MCP server that reproduces the issue; at the moment, the schema of the toy MCP server I'm using is:
{
"tools": [
{
"name": "get_random_article",
"description": "Get a random Wikipedia article",
"inputSchema": {
"type": "object",
"properties": {
"language_code": {
"type": "string",
"description": "Language code for the Wikipedia version (default: 'en' for English). Supported languages: en, es, fr, de, it, pt, ja, zh, ru, ar. corresponding to English, Spanish, French, German, Italian, Portuguese, Japanese, Chinese, Russian, Arabic."
}
},
"required": []
}
}
]
}
My impression is that we are leaving the toolUse.input field empty/undefined while Bedrock expects a specific enum/placeholder when a tool is invoked without any arguments.
Actual Behavior: Interaction with model stops on account of a malformed request.
Expected Behavior: Interaction with model should proceed.
Zed Version and System Specs
Zed: v0.185.0 (Zed Dev 24e47de02a6c1c46f077d9b808446c207c348569) OS: macOS 15.4.1 Memory: 32 GiB Architecture: aarch64
Yeah, I haven't attempted to call an MCP Server with no arguments.
Would love it if you could build a minimal reproduction -- if you can't share your implementation, perhaps there's an existing utc time MCP which has a similar argumentless tool specified.
Thanks for reporting.
You can reproduce this by asking the agent to use the builtin diagnostics tool without a specific file:
## User
could you check the project diagnostics?
## Agent
<think>
The user is asking me to check the project diagnostics. I can use the `diagnostics` tool to get a project-wide summary of errors and warnings. Since they didn't specify a particular file, I should call the diagnostics tool without a path parameter to get the overall project summary.
</think>
I'll check the project diagnostics for you to see if there are any errors or warnings.
**Use Tool: diagnostics (tooluse_Qj-sUE3-TYSUBp3D7gzqIQ)**
\```json
null
\```
**Tool Results: tooluse_Qj-sUE3-TYSUBp3D7gzqIQ**
File1.ts: 6 error(s), 0 warning(s)
File2.ts: 4 error(s), 0 warning(s)
File3.ts: 1 error(s), 0 warning(s)
Here's the error I got when using claude sonnet 4 thinking:
Error interacting with language model
client error: DisplayErrorContext(ServiceError(ServiceError { source: ValidationException(ValidationException { message: Some("The value at messages.1.content.2.toolUse.input is empty."), meta: ErrorMetadata { code: Some("ValidationException"), message: Some("The value at messages.1.content.2.toolUse.input is empty."), extras: Some({"aws_request_id": "<redacted>"}) } }), raw: Response { status: StatusCode(400), headers: Headers { headers: {"date": HeaderValue { _private: H1("Tue, 27 May 2025 10:02:23 GMT") }, "content-type": HeaderValue { _private: H1("application/json") }, "content-length": HeaderValue { _private: H1("71") }, "connection": HeaderValue { _private: H1("keep-alive") }, "x-amzn-requestid": HeaderValue { _private: H1("<redacted>") }, "x-amzn-errortype": HeaderValue { _private: H1("ValidationException:http://internal.amazon.com/coral/com.amazon.bedrock/") }} }, body: SdkBody { inner: Once(Some(b"{\"message\":\"The value at messages.1.content.2.toolUse.input is empty.\"}")), retryable: true }, extensions: Extensions { extensions_02x: Extensions, extensions_1x: Extensions } } }))
This issue is still occurring as of v0.192.3.
Following on smthsm's comment above, I confirm that this affects all tools and not just MCP tools; i.e. we get an error if any tool is invoked without any arguments, MCP or otherwise.
From smthsm's comment we can reproduce the issue with:
could you check the project diagnostics?
The following prompt also reproduces the issue:
I'm testing a new agent tool, it's called diagnostics. Are you able to call it without any arguments?
I'm no longer able to reproduce the issue as of Zed v0.193.0 (Preview).
Looking around I see it was fixed by https://github.com/zed-industries/zed/pull/33369.