fix(ai): default tool call arguments to empty object for Google providers

When Google providers return tool calls without an args field (common for
no-argument tools), the arguments field was undefined. This breaks
subsequent API calls that require tool_use.input to be present.

Now defaults to {} when args is missing.

Related: clawdbot/clawdbot#1509
This commit is contained in:
Mario Zechner 2026-01-25 03:18:02 +01:00
parent d74fd82673
commit a6d878e804
4 changed files with 108 additions and 3 deletions

View file

@ -685,7 +685,7 @@ export const streamGoogleGeminiCli: StreamFunction<"google-gemini-cli", GoogleGe
type: "toolCall",
id: toolCallId,
name: part.functionCall.name || "",
arguments: part.functionCall.args as Record<string, unknown>,
arguments: (part.functionCall.args as Record<string, unknown>) ?? {},
...(part.thoughtSignature && { thoughtSignature: part.thoughtSignature }),
};