{"record":{"id":"d5c584e59bb35c9a","repo":"zed-industries/zed","slug":"anthropic-does-not-support-custom-tool-calls","errorCode":null,"errorMessage":"Anthropic does not support custom tool calls","messagePattern":"Anthropic does not support custom tool calls","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/anthropic/src/completion.rs","lineNumber":228,"sourceCode":"                Ok(None)\n            }\n        }\n        MessageContent::Image(image) => Ok(Some(RequestContent::Image {\n            source: ImageSource {\n                source_type: \"base64\".to_string(),\n                media_type: \"image/png\".to_string(),\n                data: image.source.to_string(),\n            },\n            cache_control: None,\n        })),\n        MessageContent::ToolUse(tool_use) => match tool_use.input {\n            LanguageModelToolUseInput::Json(input) => Ok(Some(RequestContent::ToolUse {\n                id: tool_use.id.to_string(),\n                name: tool_use.name.to_string(),\n                input,\n                cache_control: None,\n            })),\n            LanguageModelToolUseInput::Text(_) => Err(anyhow::anyhow!(\n                \"Anthropic does not support custom tool calls\"\n            )),\n        },\n        MessageContent::ToolResult(tool_result) => {\n            let content = match tool_result.content.as_slice() {\n                [LanguageModelToolResultContent::Text(text)] => {\n                    ToolResultContent::Plain(text.to_string())\n                }\n                _ => {\n                    let parts = tool_result\n                        .content\n                        .into_iter()\n                        .map(|part| match part {\n                            LanguageModelToolResultContent::Text(text) => ToolResultPart::Text {\n                                text: text.to_string(),\n                            },\n                            LanguageModelToolResultContent::Image(image) => ToolResultPart::Image {\n                                source: ImageSource {","sourceCodeStart":210,"sourceCodeEnd":246,"githubUrl":"https://github.com/zed-industries/zed/blob/916fc2b8cb3a815cbef4a3b40e13081be72036b6/crates/anthropic/src/completion.rs#L210-L246","documentation":"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.","triggerScenarios":"Thrown at crates/anthropic/src/completion.rs:228 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","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"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"916fc2b8cb3a815cbef4a3b40e13081be72036b6","analyzedAt":"2026-08-20T19:29:52.058Z","contentChangedAt":"2026-08-20T19:29:52.058Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}