Skip to content

fix(provider): Copilot Gemini models fail to produce structured tool calls #15315

Description

@yangheng95

Description

Copilot Gemini Flash models (e.g. gemini-3-flash-preview) cannot make structured tool calls. The model outputs plain-text descriptions like [tool_call: mirror-url ...] instead of structured tool_calls in the response.

Root cause

sanitizeGemini in ProviderTransform.schema() matches Copilot Gemini models via api.id.includes("gemini"). This transform is designed for Google's native Gemini API, but Copilot models use an OpenAI-compatible endpoint — the Copilot API handles Gemini schema conversion internally.

Two post-v1.1.49 commits added aggressive schema transforms that produce double-transformed schemas the Copilot translation layer can't handle:

This breaks tool calling for Copilot Gemini models. Copilot Claude/GPT models are unaffected (they don't match includes("gemini")).

Steps to reproduce

  1. Authenticate with GitHub Copilot
  2. Select a Gemini model (e.g. gemini-3-flash-preview)
  3. Send a message that should trigger a tool call
  4. Observe that the model outputs a plain-text tool call description instead of a structured tool_calls response

Expected behavior

The model should produce structured tool_calls in the response, the same as Copilot Haiku or GPT models.

Environment

  • OpenCode version: any post-v1.1.49
  • Provider: github-copilot
  • Model: gemini-3-flash-preview

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions