-
Notifications
You must be signed in to change notification settings - Fork 10.4k
Description
Bug Description
sanitizeGemini in transform.ts strips properties and required from non-object types, but misses the case where type is entirely undefined.
This is a follow-up edge case from #11889 / PR #11888.
Root Cause
The current check:
if (result.type && result.type !== "object") {
delete result.properties
delete result.required
}When type is undefined, result.type && ... short-circuits to false, so properties/required are not removed.
Reproduction
MCP tools like Notion MCP define schemas where type is omitted but properties/required are present:
{
"data": {
"description": "The data required for updating a page",
"properties": { "page_id": { "type": "string" } },
"required": ["page_id"]
}
}This causes:
Bad Request: GenerateContentRequest.tools[0].function_declarations[90].parameters.properties[data].properties: only allowed for OBJECT type
Expected Behavior
Schemas with properties/required but no type should be treated as implicit objects (per JSON Schema spec) and have type: "object" added.
Proposed Fix
// Add type "object" for schemas with properties/required but missing type
if (!result.type && (result.properties || result.required)) {
result.type = "object"
}Environment
- OpenCode v1.1.56
- Notion MCP Server
- Gemini model (google provider)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels