zed-industries/zed · error

Anthropic does not support custom tools

Error message

Anthropic does not support custom tools

What it means

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.

Solutions

  1. Route requests containing custom tools to a provider that implements them
  2. Express the tool as a Function tool with an explicit input_schema
  3. Strip custom tools from the Anthropic request and rely on function-call tools for tool use
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/anthropic/src/completion.rs:391 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/69f75f3698262b28. Report an issue: GitHub.

Appendix: source

Thrown at crates/anthropic/src/completion.rs:394

        Some(StringOrContents::String(system_message))
    };

    let mut tools: Vec<Tool> = request
        .tools
        .into_iter()
        .map(|tool| match tool.input {
            LanguageModelRequestToolInput::Function {
                input_schema,
                use_input_streaming,
            } => Ok(Tool {
                name: tool.name,
                description: tool.description,
                input_schema,
                eager_input_streaming: use_input_streaming,
                cache_control: None,
            }),
            LanguageModelRequestToolInput::Custom { .. } => {
                Err(anyhow::anyhow!("Anthropic does not support custom tools"))
            }
        })
        .collect::<Result<_>>()?;
    if let Some(cache_control) = long_lived_cache
        && let Some(last_tool) = tools.last_mut()
    {
        last_tool.cache_control = Some(cache_control);
    }

    let thinking = if request.thinking_allowed {
        match mode {
            AnthropicModelMode::Thinking { budget_tokens } => {
                Some(Thinking::Enabled { budget_tokens })
            }
            AnthropicModelMode::AdaptiveThinking => Some(Thinking::Adaptive {
                display: Some(AdaptiveThinkingDisplay::Summarized),
                block_binding: crate::binds_thinking_blocks_to_prefix(&model).then_some(
                    ThinkingBlockBinding {

View on GitHub (pinned to 916fc2b8cb)