Gemini Function Declaration Builder
Define a function (name, description, parameters) and get the exact FunctionDeclaration JSON that Google Gemini and Vertex AI expect for tool calls. The form mirrors Google's OpenAPI-3-subset spec: parameter types must be one of STRING, NUMBER, INTEGER, BOOLEAN, ARRAY, or OBJECT, and the names must be machine-friendly. Output validates as you type.
Parameters
How to use the Gemini Function Declaration Builder
Set the function name and a one-sentence description (Gemini reads this to decide when to call your function — be specific). Add each parameter the function takes, with its type, a description, and whether it's required. The right pane updates live with the JSON. Copy it directly, or grab the Python / Node SDK snippet for ready-to-paste integration with google-generativeai or @google/generative-ai.
About Gemini Function Declaration Builder
Gemini's function calling lets a model decide to invoke a function you defined, with the arguments extracted from the user's prompt. To do that the model needs a machine-readable description of every available function — what it does, what arguments it takes, what types those arguments are. That description is the FunctionDeclaration object, and Google uses a constrained subset of OpenAPI 3 to specify it.
The format is straightforward but easy to get wrong: type names must be uppercase (STRING, not string), nested objects need their own properties block, and the required array names which keys are mandatory. Get any of these wrong and the API rejects the request with an unhelpful error. This builder enforces the rules on the form side so the output is always valid, and you can paste it directly into either Google AI Studio's tool config or your application code via the official SDKs.
Common use cases
- RAG with structured retrieval — declare
search_knowledge_base(query, filters)so Gemini picks the right filter combination. - Agent tool sets — declare every external action (send_email, create_ticket, run_query) so the model can route requests appropriately.
- Form-filling assistants — declare
submit_form(name, address, ...)so the model gathers the right fields conversationally before calling. - Comparing tool definitions across providers — pair with our OpenAI Function Builder to keep equivalent tool shapes in sync.
Frequently asked questions
Is this compatible with Vertex AI?
Why uppercase type names?
Type enum, which is uppercase. Lowercase (string) is the JSON Schema convention and will fail validation against Gemini.Can a parameter be an object with nested fields?
OBJECT as the type. The builder lets you describe the object shape via a description; for deeply nested structures, paste a custom parameters JSON into the output and edit by hand. Most production tools use flat parameter lists.Does the model always call my function?
tool_config.function_calling_config.mode to ANY forces a call; AUTO lets the model decide; NONE disables tools.