https://linen.dev logo
Gemini tool schema incompatibility in Composio Lan...
# 🖥│support-forum
d
Environment Node 18 or 20 TypeScript LangChain JS + @langchain/google-genai (latest) Composio SDK (latest) Model: gemini-2.0-flash Summary `composio.tools.get(...) `returns tool schemas that Gemini rejects when used via LangChain. The payload includes JSON Schema features Gemini’s function_declarations.parameters does not accept: anyOf, multi-type type arrays with null, and default. Result is a 400. Repro
Copy code
ts
const tools = await composio.tools.get(entityId, { toolkits: apps });

const model = llm.bind({ tools });

await model.invoke("test");
Observe 400 from the Google Generative Language API. Actual 400 Bad Request with paths like: Unknown name "type" at ... parameters.properties[...].any_of[0] Example offending schema SLACKBOT_CREATE_CHANNEL parameters include:
Copy code
json
{
  "is_private": { "anyOf": [ { "type": ["boolean","null"] }, { "type": "null" } ] },
  "team_id":   { "anyOf": [ { "type": ["string","null"] },  { "type": "null" } ] }
}
Expected Composio should emit Gemini-compatible tool schemas or provide a compatibility option to normalize schemas for Google function_declarations. Impact Blocks using Composio tools with Gemini 2.x, notably Slack toolkit. Suggested fix Remove anyOf/oneOf/allOf, or collapse [T, null] to T Rewrite ["string","null"] to "string" Strip default, $ref, $defs, definitions, additionalProperties Ensure object has properties and array has items Workaround Filter or sanitize tool schemas before binding to Gemini (drop unions, convert nullable multi-type to a single type, remove unsupported keys).
fyi @udaysidagana
u
Hi @danielfrey2280 , Could you share the entire code snippet? Also, could you share the exact error logs?
c
Thanks for the information! I'll update you.
Quick Update: We were able to reproduce the error, I'll escalate this to the team.
d
any updates on this?
c
Hi Daniel, let me check with the team!
Hey Daniel, Just checked with the team and this seems like a pretty common issue with Gemini models. It uses the OpenAPI spec instead of JSONSchema, which should be handled by Google. ref: ,