mirror of
https://github.com/Nezumi-2711/9router.git
synced 2026-09-22 13:38:31 +00:00
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:
@@ -353,6 +353,19 @@ export function cleanJSONSchemaForAntigravity(schema) {
|
|||||||
function addPlaceholders(obj) {
|
function addPlaceholders(obj) {
|
||||||
if (!obj || typeof obj !== "object") return;
|
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.type === "object") {
|
||||||
if (!obj.properties || Object.keys(obj.properties).length === 0) {
|
if (!obj.properties || Object.keys(obj.properties).length === 0) {
|
||||||
obj.properties = {
|
obj.properties = {
|
||||||
|
|||||||
Reference in New Issue
Block a user