Skip to content

JSON Schema Compatibility Issue #3685

@kpopioek

Description

@kpopioek

Hello,
The MCP Apollo server we are working with, returns tool schemas in the older 'Draft 7' JSON format with 'definitions', but Google ADK's schema converter (in google/genai/types.py) expects 'Draft 2019-09+' format with '$defs'. This causes a KeyError: 'definitions' when the converter tries to resolve $ref pointers.

We fix this by monkey-patching McpTool._get_declaration to normalize schemas on-the-fly,
converting 'definitions' → '$defs' and updating all $ref paths accordingly.

Environment details
Programming language: Python 3.13.9
OS: MacOS
Language runtime version: 3.13.9
Package version:
google-adk==1.19.0
google-ai-generativelanguage==0.6.15
google-api-core==2.28.1
google-api-python-client==2.187.0
google-auth==2.43.0
google-auth-httplib2==0.2.1
google-cloud-aiplatform==1.127.0
google-cloud-appengine-logging==1.7.0
google-cloud-audit-log==0.4.0
google-cloud-bigquery==3.38.0
google-cloud-bigquery-storage==2.34.0
google-cloud-bigtable==2.34.0
google-cloud-core==2.5.0
google-cloud-discoveryengine==0.13.12
google-cloud-logging==3.12.1
google-cloud-monitoring==2.28.0
google-cloud-resource-manager==1.15.0
google-cloud-secret-manager==2.25.0
google-cloud-spanner==3.59.0
google-cloud-speech==2.34.0
google-cloud-storage==3.6.0
google-cloud-trace==1.17.0
google-crc32c==1.7.1
google-genai==1.51.0
google-generativeai==0.8.5
google-resumable-media==2.8.0
googleapis-common-protos==1.72.0

Steps to reproduce
When Agent call a tool from Apollo MCP server, it throws an error KeyError: 'definitions' when the converter tries to resolve $ref pointers.

Metadata

Metadata

Assignees

Labels

answered[Status] This issue has been answered by the maintainermcp[Component] Issues about MCP supportstale[Status] Issues which have been marked inactive since there is no user response

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions