{"record":{"id":"69f75f3698262b28","repo":"zed-industries/zed","slug":"anthropic-does-not-support-custom-tools","errorCode":null,"errorMessage":"Anthropic does not support custom tools","messagePattern":"Anthropic does not support custom tools","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/anthropic/src/completion.rs","lineNumber":394,"sourceCode":"        Some(StringOrContents::String(system_message))\n    };\n\n    let mut tools: Vec<Tool> = request\n        .tools\n        .into_iter()\n        .map(|tool| match tool.input {\n            LanguageModelRequestToolInput::Function {\n                input_schema,\n                use_input_streaming,\n            } => Ok(Tool {\n                name: tool.name,\n                description: tool.description,\n                input_schema,\n                eager_input_streaming: use_input_streaming,\n                cache_control: None,\n            }),\n            LanguageModelRequestToolInput::Custom { .. } => {\n                Err(anyhow::anyhow!(\"Anthropic does not support custom tools\"))\n            }\n        })\n        .collect::<Result<_>>()?;\n    if let Some(cache_control) = long_lived_cache\n        && let Some(last_tool) = tools.last_mut()\n    {\n        last_tool.cache_control = Some(cache_control);\n    }\n\n    let thinking = if request.thinking_allowed {\n        match mode {\n            AnthropicModelMode::Thinking { budget_tokens } => {\n                Some(Thinking::Enabled { budget_tokens })\n            }\n            AnthropicModelMode::AdaptiveThinking => Some(Thinking::Adaptive {\n                display: Some(AdaptiveThinkingDisplay::Summarized),\n                block_binding: crate::binds_thinking_blocks_to_prefix(&model).then_some(\n                    ThinkingBlockBinding {","sourceCodeStart":376,"sourceCodeEnd":412,"githubUrl":"https://github.com/zed-industries/zed/blob/916fc2b8cb3a815cbef4a3b40e13081be72036b6/crates/anthropic/src/completion.rs#L376-L412","documentation":"While translating a LanguageModelRequest into Anthropic format in into_anthropic, a tool whose input is LanguageModelRequestToolInput::Custom is encountered; the Anthropic API only accepts JSON-schema function tools, so request construction fails with this unsupported-capability error before any network call is made.","triggerScenarios":"Thrown at crates/anthropic/src/completion.rs:391 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Route requests containing custom tools to a provider that implements them","Express the tool as a Function tool with an explicit input_schema","Strip custom tools from the Anthropic request and rely on function-call tools for tool use"],"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"}