Skip to content

list_metrics incompatible with Google ADK (Vertex AI backend) due to union type schema #784

@b-per

Description

@b-per

Summary

Since v1.19, list_metrics fails when used via Google ADK with a Vertex AI backend:

list_metrics functionDeclaration parameters.search schema didn't specify the schema type field

Root cause

PR #768 widened the search parameter from str | None to str | list[str] | None. This 3-way union generates a JSON Schema with anyOf and no top-level type field:

{
  "anyOf": [
    {"type": "string"},
    {"type": "array", "items": {"type": "string"}},
    {"type": "null"}
  ]
}

The Vertex AI backend of google-genai (Schema.from_json_schema()) requires a top-level type field and rejects this. The Gemini API backend handles it correctly.

Affected versions

v1.19+ (introduced in #768)

Upstream bug

This is tracked as a P2 bug in the google-genai library: googleapis/python-genai#1807. The ADK issue google/adk-python#3424 was closed pointing there.

Workaround (client-side)

Pin to ADK v1.17.0 and google-genai==1.44.0 until the upstream fix lands.

Potential fix (dbt-mcp side)

Change search to list[str] | None (drop the str shorthand) — a 2-way union that google-genai handles correctly. LLMs pass a single-element list for single searches. This is a breaking change for callers passing a plain string, so pending feedback.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    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