Skip to content

[Bug]: Tool Calling using Google Antigravity #746

@ghost

Description

Bug Report: Google Cloud Code Assist / Antigravity JSON Schema Validation Failures

Summary

The Google Cloud Code Assist API (accessed via google-antigravity provider) has extremely strict JSON Schema validation for tool/function calling, causing repeated failures (400 "format" errors) with tool schemas that work fine on other providers (Anthropic, OpenAI, etc.).

Impact

  • Tool calling with google-antigravity/claude-* models frequently fails with JSON Schema validation errors
  • Users see repetitive "format" failures (80+ errors in my usage stats)
  • Forces users to use different providers as primary fallbacks

Root Cause

The Cloud Code Assist API rejects a large subset of standard JSON Schema keywords that are used by tool libraries and other LLM providers:

Completely Rejected:

  • Structure defs: $ref, $defs, definitions, $schema, $id, patternProperties, additionalProperties, examples

Validation Constraints (strict - cause 400 on any match):

  • minLength, maxLength, minimum, maximum, multipleOf, pattern, format
  • minItems, maxItems, uniqueItems
  • minProperties, maxProperties

Current Mitigation (in codebase)

The project already has a workaround at src/agents/schema/clean-for-gemini.ts that strips these keywords, but this:

  • Loses important validation (e.g., pattern matching, min/max lengths)
  • Requires schema modification before provider selection
  • Doesn't handle all edge cases

Request

Please investigate whether:

  1. This is intentional - Cloud Code Assist is designed for a stricter schema subset and apps must comply
  2. A bug on Google's side - The validation should accept more of standard JSON Schema Draft 2020-12
  3. A version mismatch - Different models/routes have different schema support
  4. A misconfiguration - There's an API flag or header to enable looser validation

Reproduction

Any tool schema using standard validation keywords like:
{
"type": "string",
"minLength": 1,
"pattern": "^[a-z]+$"
}

Causes 400 error through Cloud Code Assist but works on Anthropic/OpenAI APIs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghelp wantedExtra attention is needed

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions