Skip to content

fix: include tool call id for non-Claude, non-Gemini models - #357

Open
kenny000666 wants to merge 1 commit into
badrisnarayanan:mainfrom
kenny000666:fix/tool-call-id-for-all-models
Open

fix: include tool call id for non-Claude, non-Gemini models#357
kenny000666 wants to merge 1 commit into
badrisnarayanan:mainfrom
kenny000666:fix/tool-call-id-for-all-models

Conversation

@kenny000666

Copy link
Copy Markdown

Summary

functionCall.id and functionResponse.id must be populated for all models when using Google Cloud Code API, except for Gemini models which use thoughtSignature instead. The current isClaudeModel guard only sets these fields for Claude models, breaking tool calls for any other model family.

Changes

Changed the guard from isClaudeModel to !isGeminiModel in src/format/content-converter.js:

  • tool_use → functionCall: isClaudeModel && block.id!isGeminiModel && block.id
  • tool_result → functionResponse: isClaudeModel && block.tool_use_id!isGeminiModel && block.tool_use_id

Why this matters

With PR #354 adding the gpt-oss model family, users will encounter tool call failures:

Expected the 'id' of a(n) 'assistant' 'tool_calls' array element to be populated.

This fix ensures any non-Gemini model family works correctly with tool calls, not just Claude.

Compatibility

Model Before After
Claude Gets id Gets id ✅ (unchanged)
Gemini No id ✅ (uses thoughtSignature) No id ✅ (unchanged)
gpt-oss (or any future family) No id ❌ (broken tool calls) Gets id ✅ (fixed)

Related

The functionCall.id and functionResponse.id fields are required by Google
Cloud Code API for all models except Gemini. The previous isClaudeModel
guard meant that only Claude models received the id field, which broke
tool calls for non-Claude, non-Gemini model families (e.g. gpt-oss).

Changed the guard from isClaudeModel to !isGeminiModel so that:
- Claude models still get the id (unchanged)
- Gemini models do NOT get the id (unchanged - uses thoughtSignature)
- gpt-oss and any future model families get the id (fixes tool calls)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant