Skip to content

language_models: Handle empty tool call arguments consistently#48958

Merged
benbrandt merged 1 commit intozed-industries:mainfrom
dastrobu:fix/no-arg-mcp-tool-calls
Feb 12, 2026
Merged

language_models: Handle empty tool call arguments consistently#48958
benbrandt merged 1 commit intozed-industries:mainfrom
dastrobu:fix/no-arg-mcp-tool-calls

Conversation

@dastrobu
Copy link
Contributor

Normalize handling of empty tool call arguments across all LLM providers. Many providers return empty strings for tool calls with no arguments, which would previously fail JSON parsing.

  • Created shared parse_tool_arguments() helper in provider/util.rs that treats empty strings as empty JSON objects ({})
  • Refactored 10 occurrences across 9 provider files to use the helper
  • Ensures consistent behavior across all providers (anthropic, bedrock, copilot_chat, deepseek, lmstudio, mistral, open_ai, open_router)

Closes: #48955

Release Notes:

  • Fixed tool calls with no arguments failing when using certain LLM providers

@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Feb 11, 2026
@zed-community-bot zed-community-bot bot added the first contribution the author's first pull request to Zed. NOTE: the label application is automated via github actions label Feb 11, 2026
@dastrobu dastrobu force-pushed the fix/no-arg-mcp-tool-calls branch from 0ec28eb to bf7ad5d Compare February 11, 2026 17:34
@SomeoneToIgnore SomeoneToIgnore added the area:ai Improvement related to Agent Panel, Edit Prediction, Copilot, or other AI features label Feb 11, 2026
@benbrandt benbrandt self-assigned this Feb 12, 2026
Copy link
Member

@benbrandt benbrandt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, seems like a nice change!

Normalize handling of empty tool call arguments across all LLM
providers.
Many providers return empty strings for tool calls with no arguments,
which would previously fail JSON parsing.

- Created shared parse_tool_arguments() helper in provider/util.rs that
  treats empty strings as empty JSON objects ({})
- Refactored 10 occurrences across 9 provider files to use the helper
- Ensures consistent behavior across all providers (anthropic, bedrock,
  copilot_chat, deepseek, lmstudio, mistral, open_ai, open_router)

Closes: zed-industries#48955

Release Notes:

- Fixed tool calls with no arguments failing when using certain LLM
  providers
@dastrobu dastrobu force-pushed the fix/no-arg-mcp-tool-calls branch from bf7ad5d to 8c0e134 Compare February 12, 2026 13:55
@dastrobu
Copy link
Contributor Author

Thanks, seems like a nice change!

Looking forward to use it in day to day life.

I fixed the formatting/importing issues. Forgot to run fmt/clippy.

@benbrandt benbrandt enabled auto-merge (squash) February 12, 2026 13:57
@benbrandt benbrandt merged commit 22c16b6 into zed-industries:main Feb 12, 2026
27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:ai Improvement related to Agent Panel, Edit Prediction, Copilot, or other AI features cla-signed The user has signed the Contributor License Agreement first contribution the author's first pull request to Zed. NOTE: the label application is automated via github actions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MCP tools with no arguments fail with "Tool call not found" when using OpenAI (compatible) API

3 participants