fix(gemini): fill empty tool schemas after $ref strip
Vertex rejects orphan {} left when $ref/$defs are removed from function declarations. Promote empty nodes to object+reason placeholder in addPlaceholders.
This commit is contained in:
parent
0afe949387
commit
e3e3e235f6
1 changed files with 13 additions and 0 deletions
|
|
@ -353,6 +353,19 @@ export function cleanJSONSchemaForAntigravity(schema) {
|
|||
function addPlaceholders(obj) {
|
||||
if (!obj || typeof obj !== "object") return;
|
||||
|
||||
// Empty schema {} (no type, no properties) after $ref removal — treat as object with placeholder
|
||||
if (Object.keys(obj).length === 0) {
|
||||
obj.type = "object";
|
||||
obj.properties = {
|
||||
reason: {
|
||||
type: "string",
|
||||
description: "Brief explanation of why you are calling this tool"
|
||||
}
|
||||
};
|
||||
obj.required = ["reason"];
|
||||
return;
|
||||
}
|
||||
|
||||
if (obj.type === "object") {
|
||||
if (!obj.properties || Object.keys(obj.properties).length === 0) {
|
||||
obj.properties = {
|
||||
|
|
|
|||
Loading…
Reference in a new issue