Skip to content

Cloud Intergration API code dropping connections after tool calls #4033

@ashwinjo

Description

@ashwinjo

** Please make sure you read the contribution guide and file the issues in the right place. **
Contribution guide.

Describe the bug

When using Cloud Intergration API, The connection drops after the tool call.

Attached is the example I am runnning.

Image

Here my code Sample:

import os

from google.adk.apps.app import App
from google.adk.agents.llm_agent import LlmAgent
from google.adk.tools.api_registry import ApiRegistry

# TODO: Fill in with your GCloud project id and MCP server name
PROJECT_ID = "adkstuff"
MCP_SERVER_NAME = "projects/adkstuff/locations/global/mcpServers/google-mapstools.googleapis.com-mcp"

api_registry = ApiRegistry(PROJECT_ID)
registry_tools = api_registry.get_toolset(
    mcp_server_name=MCP_SERVER_NAME,
)
root_agent = LlmAgent(
    model="gemini-2.0-flash",
    name="google_maps_agent",
    instruction=f"""
You are a helpful data analyst agent with access to Google Maps. The project ID is: {PROJECT_ID}

When users ask about data:
- Use the project ID {PROJECT_ID} when calling Google Maps tools.

Mandatory Requirements:
- Always use the Google Maps tools to fetch real data rather than making assumptions.
- For all Google Maps operations, use project_id: {PROJECT_ID}.
    """,
    tools=[registry_tools],
)

app = App(root_agent=root_agent, name="agent_google_cloud_tools")

I am using

ubuntusand@ubuntusand:~/containerlanAsh/2-basic-agent-with-tools$ uv pip show google-adk
Name: google-adk
Version: 1.20.0
Location: /home/ubuntusand/containerlanAsh/2-basic-agent-with-tools/.venv/lib/python3.10/site-packages
Requires: aiosqlite, anyio, authlib, click, fastapi, google-api-python-client, google-cloud-aiplatform, google-cloud-bigquery, google-cloud-bigquery-storage, google-cloud-bigtable, google-cloud-discoveryengine, google-cloud-secret-manager, google-cloud-spanner, google-cloud-speech, google-cloud-storage, google-genai, graphviz, jsonschema, mcp, opentelemetry-api, opentelemetry-exporter-gcp-logging, opentelemetry-exporter-gcp-monitoring, opentelemetry-exporter-gcp-trace, opentelemetry-exporter-otlp-proto-http, opentelemetry-resourcedetector-gcp, opentelemetry-sdk, pyarrow, pydantic, python-dateutil, python-dotenv, pyyaml, requests, sqlalchemy, sqlalchemy-spanner, starlette, tenacity, typing-extensions, tzlocal, uvicorn, watchdog, websockets
Required-by: 2-basic-agent-with-tools

Metadata

Metadata

Assignees

No one assigned

    Labels

    mcp[Component] Issues about MCP supporttools[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