zed-industries/zed · error
Anthropic does not support custom tool calls
Error message
Anthropic does not support custom tool calls
What it means
Converting message content for the Anthropic API, a tool use carried LanguageModelToolUseInput::Custom (custom tool input), which Anthropic's API does not accept; only JSON-schema tool uses are supported.
Solutions
- Send custom tools to a provider/backend that supports them (e.g. the client-side tool runner) instead of Anthropic
- Convert the custom tool to a JSON-schema function tool before building the Anthropic request
- Filter custom tools out of the request and let the agent fall back to function-call equivalents
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at crates/anthropic/src/completion.rs:228 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of zed-industries/zed@916fc2b8cb (2026-08-20).
Data as JSON: /api/errors/d5c584e59bb35c9a.
Report an issue: GitHub.
Appendix: source
Thrown at crates/anthropic/src/completion.rs:228
Ok(None)
}
}
MessageContent::Image(image) => Ok(Some(RequestContent::Image {
source: ImageSource {
source_type: "base64".to_string(),
media_type: "image/png".to_string(),
data: image.source.to_string(),
},
cache_control: None,
})),
MessageContent::ToolUse(tool_use) => match tool_use.input {
LanguageModelToolUseInput::Json(input) => Ok(Some(RequestContent::ToolUse {
id: tool_use.id.to_string(),
name: tool_use.name.to_string(),
input,
cache_control: None,
})),
LanguageModelToolUseInput::Text(_) => Err(anyhow::anyhow!(
"Anthropic does not support custom tool calls"
)),
},
MessageContent::ToolResult(tool_result) => {
let content = match tool_result.content.as_slice() {
[LanguageModelToolResultContent::Text(text)] => {
ToolResultContent::Plain(text.to_string())
}
_ => {
let parts = tool_result
.content
.into_iter()
.map(|part| match part {
LanguageModelToolResultContent::Text(text) => ToolResultPart::Text {
text: text.to_string(),
},
LanguageModelToolResultContent::Image(image) => ToolResultPart::Image {
source: ImageSource {View on GitHub (pinned to 916fc2b8cb)