zed-industries/zed · error

Google AI does not support custom tools

Error message

Google AI does not support custom tools

What it means

Validation in the Google AI request conversion (into_google): the request contained entries in `tools` whose input is not a plain function tool (LanguageModelRequestToolInput::Function), which the Gemini API cannot represent; such requests are rejected.

Source

Thrown at crates/google_ai/src/completion.rs:146

    };

    let tools = if request.tools.is_empty() {
        None
    } else {
        Some(vec![crate::Tool {
            function_declarations: request
                .tools
                .into_iter()
                .map(|tool| match tool.input {
                    LanguageModelRequestToolInput::Function { input_schema, .. } => {
                        Ok(FunctionDeclaration {
                            name: tool.name,
                            description: tool.description,
                            parameters: None,
                            parameters_json_schema: Some(input_schema),
                        })
                    }
                    LanguageModelRequestToolInput::Custom { .. } => {
                        Err(anyhow::anyhow!("Google AI does not support custom tools"))
                    }
                })
                .collect::<Result<_>>()?,
        }])
    };

    Ok(crate::GenerateContentRequest {
        model: ModelName { model_id },
        system_instruction: system_instructions,
        contents: request
            .messages
            .into_iter()
            .map(|message| {
                let parts = map_content(message.content)?;
                if parts.is_empty() {
                    Ok(None)
                } else {

View on GitHub (pinned to 5a9b9558db)

Solutions

  1. Disable custom tools in the request when targeting Google AI models
  2. Use a provider that supports function/tool calls (Anthropic, OpenAI) if tools are required
  3. Emulate tool usage via prompt-based JSON instructions instead of the tools API
  4. Check the model selection: switch to a model/provider combination that supports tools
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/google_ai/src/completion.rs:146 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of zed-industries/zed@5a9b9558db (2026-08-20). Data as JSON: /api/errors/ec1e653f17cb69e2. Report an issue: GitHub.