{"record":{"id":"ec1e653f17cb69e2","repo":"zed-industries/zed","slug":"google-ai-does-not-support-custom-tools","errorCode":null,"errorMessage":"Google AI does not support custom tools","messagePattern":"Google AI does not support custom tools","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/google_ai/src/completion.rs","lineNumber":146,"sourceCode":"    };\n\n    let tools = if request.tools.is_empty() {\n        None\n    } else {\n        Some(vec![crate::Tool {\n            function_declarations: request\n                .tools\n                .into_iter()\n                .map(|tool| match tool.input {\n                    LanguageModelRequestToolInput::Function { input_schema, .. } => {\n                        Ok(FunctionDeclaration {\n                            name: tool.name,\n                            description: tool.description,\n                            parameters: None,\n                            parameters_json_schema: Some(input_schema),\n                        })\n                    }\n                    LanguageModelRequestToolInput::Custom { .. } => {\n                        Err(anyhow::anyhow!(\"Google AI does not support custom tools\"))\n                    }\n                })\n                .collect::<Result<_>>()?,\n        }])\n    };\n\n    Ok(crate::GenerateContentRequest {\n        model: ModelName { model_id },\n        system_instruction: system_instructions,\n        contents: request\n            .messages\n            .into_iter()\n            .map(|message| {\n                let parts = map_content(message.content)?;\n                if parts.is_empty() {\n                    Ok(None)\n                } else {","sourceCodeStart":128,"sourceCodeEnd":164,"githubUrl":"https://github.com/zed-industries/zed/blob/5a9b9558db01a6b906cec2fb70a797affdc58cdd/crates/google_ai/src/completion.rs#L128-L164","documentation":"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.","triggerScenarios":"Thrown at crates/google_ai/src/completion.rs:146 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Disable custom tools in the request when targeting Google AI models","Use a provider that supports function/tool calls (Anthropic, OpenAI) if tools are required","Emulate tool usage via prompt-based JSON instructions instead of the tools API","Check the model selection: switch to a model/provider combination that supports tools"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"5a9b9558db01a6b906cec2fb70a797affdc58cdd","analyzedAt":"2026-08-20T19:29:52.058Z","contentChangedAt":"2026-08-20T19:29:52.058Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}