Gemini function error
Debug Gemini MALFORMED_FUNCTION_CALL with a schema-first check
Separate tool schema problems from model argument failures when Gemini returns MALFORMED_FUNCTION_CALL.
MALFORMED_FUNCTION_CALL can be an argument-generation failure, but ambiguous names, weak descriptions, unsupported schema features, and over-large active tool sets make it more likely.
Read the schema and its provider wrapper as one contract. APITC distinguishes target requirements from portable JSON Schema, applies mechanical repairs only when intent is recoverable, and identifies transformations that can change meaning.
Diagnostic procedure
Repair the schema, then recompile.
- 01
Minimize the declaration
Start with one function and its required fields, then reintroduce optional constraints.
- 02
Compile to Gemini’s subset
Remove unsupported JSON Schema vocabulary and normalize nullable values.
- 03
Strengthen routing cues
Give the function and every parameter a precise, model-facing description.
{"name":"go","parameters":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","patternProperties":{"^x-":{"type":"string"}}}}{"type":"function","name":"find_customer","description":"Find one customer by an exact account ID.","parameters":{"type":"object","properties":{"account_id":{"type":"string","description":"Exact CRM account ID"}},"required":["account_id"]}}$.inputSchemaClose this objectOpenAI strict requires additionalProperties: false on every object.
$.inputSchemaRequired array is incompleteStrict mode requires every property in required. APITC will make limit nullable.
No account · no upload · no endpoint calledOpen the full tool schema compiler and operating notes →
FAQ
Before you ship
Does APITC upload my schema?
No. Parsing, diagnostics, and compilation run in your browser tab.
Is the compiled result guaranteed to preserve meaning?
Safe repairs are deterministic. When Gemini cannot express a source constraint, APITC labels the transform as lossy instead of hiding it.
Protocol behavior checked against the Gemini function calling guide. Recheck your pinned provider/API version before production deployment.