Skip to content

SheetsToolset overloads LLM with 500k+ tokens caused by loaded tools #2126

@SAMFVH

Description

@SAMFVH

The sheets_spreadsheets_create tool within SheetsToolset contains an excessively verbose schema, causing the initial prompt to contain over 500k tokens. With over 100,000 references to color properties and styling options, causing massive token consumption that makes the toolset unusable in practice.
To Reproduce

Steps to reproduce the behavior:

Create an agent which loads the google api toolset: SheetsToolset:

Install pip install google-adk==1.4.2
Initialize SheetsToolset and inspect the create tool:

Set a breakpoint to googleapi_to_openapi_converter.py line 106.

def convert(self) -> Dict[str, Any]:
"""Convert the Google API spec to OpenAPI v3 format.

Returns:
    Dict containing the converted OpenAPI v3 specification
"""
if not self._google_api_spec:
  self.fetch_google_api_spec()

# Convert basic API information
self._convert_info()

# Convert server information
self._convert_servers()

# Convert authentication/authorization schemes
self._convert_security_schemes()

# Convert schemas (models)
self._convert_schemas()

# Convert endpoints/paths
self._convert_resources(self._google_api_spec.get("resources", {}))

# Convert top-level methods, if any
self._convert_methods(self._google_api_spec.get("methods", {}), "/")

return self._openapi_spec

Tokencount exceeds 500k tokens.

Count occurrences of "color" in the schema
Observe 100,000+ color-related properties in the spec

Expected behavior
The sheets_spreadsheets_create endpoint should have a minimal schema focused on essential properties without exhaustive styling options. Color and formatting properties should be optional or excluded from the base tool. Creating a sheet, editing, updating, basic formatting.

OS: macOS 15.5
Python version: 3.11.0
ADK version: 1.4.2

Model Information:
Affects all models - the schema alone exceeds most context windows before any actual usage
Used gemini-2.5-pro.

The Google Sheets API discovery document includes comprehensive styling options for every possible cell property (backgroundColor, foregroundColor, borders, etc.) with full RGBA specifications. This is multiplied across:

Cell properties
Row properties
Column properties
Sheet properties
Conditional formatting rules
Chart specifications

Recommended fix: Create an LLM proof (minimal) open api spec.

Metadata

Metadata

Labels

tools[Component] This issue is related to tools

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions