skip to Main Content
Welcome to Gimasys!
Hotline: +84 974 417 099 (HCM) | +84 987 682 505 (HN) gcp@gimasys.com

BigQuery meets ADK & MCP: Accelerate agent development with BigQuery's new first-party toolset

The AI ​​Agent revolution is happening at breakneck speed, and every business wants to have its own autonomous “digital workers”. However, the path from idea to a truly useful AI Agent, capable of reasoning on internal data and performing complex tasks, is fraught with challenges: fragmented data, expensive model customization, and a lack of a unified development toolkit.

To break down this barrier and empower developers, Google has made a strategic move. Google BigQuery combined with ADK & MCP is now not just a data warehouse, but also the center of a whole new Agent development ecosystem with the launch of exclusive toolkits: Agent Development Kit (ADK) and Model Customization Platform (MCP).

This is more than just an update; it's a statement of a new approach that promises to dramatically accelerate the process of bringing intelligent, deeply customized AI Agents into business practice, directly from where your data lives.

Why use Google BigQuery application combined with ADK & MCP?

As the excitement around AI agents reaches enterprise customers, a critical question emerges: How can we empower these agents to securely and intelligently interact with enterprise data systems like Google Cloud BigQuery?

Currently, the developers building agentic applications have been forced to build and maintain their own custom tools, a process that is slow, risky, and distracts from building innovative applications. This introduces considerable development overhead and risk, as they become responsible for everything from authentication and error handling to keeping pace with BigQuery's evolving capabilities.

To solve this, we are introducing a new, first-party toolset for BigQuery that includes tools to fetch metadata and execute queries (and we have more on the way):

  • list_dataset_ids: Fetches BigQuery dataset ids present in a GCP project.
  • get_dataset_info: Fetches metadata about a BigQuery dataset.
  • list_table_ids: Fetches table ids present in a BigQuery dataset.
  • get_table_info: Fetches metadata about a BigQuery table.
  • execute_sql: Runs a SQL query in BigQuery and fetch the result.

These official, Google-maintained tools provide a secure and reliable bridge to your data, and you can use them in two powerful ways: a built-in toolset in Google’s Agent Development Kit (ADK) or through the flexible, open-source MCP Toolbox for Databases. This frees you to focus on creating value, not on building foundational plumbing.

Tutorial: Build a Conversational Analytics Agent using BigQuery’s first-party tools

Our agent will query BigQuery’s public dataset: thelook_ecommerce, a synthetic e-commerce dataset that includes customer details, product inventories, and order histories. The agent’s primary role will be to generate SQL queries and provide meaningful responses to common business questions, such as: What are the top-selling products? Which products are frequently ordered together? And how many customers do we have in Colombia?

You first need to create a python environment and install ADK.You can then invoke the adk utility to create a new bq-agent-app ADK application in the current folder:

adk create bq-agent-app

Choose your model, select Vertex AI as the backend, and confirm your project id and region:

You should now have a new folder named bq-agent-app. Navigate to agent.py and update the root LLM-Agent to reflect our conversational analytics agent:

lang-py

root_agent = Agent(

  model=”gemini-2.0-flash”,

  name=”bigquery_agent”,

  description=(

      “Agent that answers questions about BigQuery data by executing SQL queries”

  ),

  instruction=””” You are a data analysis agent with access to several BigQuery tools. Make use of those tools to answer the user’s questions.

  “””,

  tools=[bigquery_toolset],

)

When defining your agent, you provide a unique name, specify the underlying LLM model, and can optionally include a description that helps other agents understand its purpose. The agent's core task or goal is defined in the instructions.

Finally, to enable the agent to interact with your data, it must be equipped with tools that allow it to interact with BigQuery so it can understand the available datasets and tables, and of course, execute queries. Let’s consider our options when it comes to using BigQuery’s first-party toolset.

Option 1: Use ADK’s new built-in toolset for BigQuery

This first-party toolset is owned and maintained by Google. To assign these tools to your agent, you need to import the BigQueryToolset from the agents.tools module and then initialize the toolset:

lang-py

from google.adk.tools.bigquery import BigQueryCredentialsConfig

from google.adk.tools.bigquery import BigQueryToolset

import google.auth

# Define an appropriate credential type

CREDENTIALS_TYPE = AuthCredentialTypes.OAUTH2

# Write modes define BigQuery access control of agent:

# ALLOWED: Tools will have full write capabilites.

# BLOCKED: Default mode. Effectively makes the tool read-only.

# PROTECTED: Only allows writes on temporary data for a given BigQuery session.

tool_config = BigQueryToolConfig(write_mode=WriteMode.ALLOWED)

if CREDENTIALS_TYPE == AuthCredentialTypes.OAUTH2:

 # Initiaze the tools to do interactive OAuth

 credentials_config = BigQueryCredentialsConfig(

     client_id=os.getenv(“OAUTH_CLIENT_ID”),

     client_secret=os.getenv(“OAUTH_CLIENT_SECRET”),

 )

elif CREDENTIALS_TYPE == AuthCredentialTypes.SERVICE_ACCOUNT:

 # Initialize the tools to use the credentials in the service account key.

 creds, _ = google.auth.load_credentials_from_file(“service_account_key.json”)

 credentials_config = BigQueryCredentialsConfig(credentials=creds)

else:

 # Initialize the tools to use the application default credentials.

 application_default_credentials, _ = google.auth.default()

 credentials_config = BigQueryCredentialsConfig(

     credentials=application_default_credentials

 )

bigquery_toolset = BigQueryToolset(credentials_config=credentials_config,   tool_filter=[

‘list_dataset_ids’,

‘get_dataset_info’,

‘list_table_ids’,

‘get_table_info’,

‘execute_sql’,

    ])

You can use the tool_filter parameter to filter the tools you’d like to expose to the agent.

A note on authentication…

You currently have three options for authenticating with BigQuery:

  • Use the application default credentials that are associated with the environment where the code is running.
  • Use service account credentials by loading them from a service account key file.
  • Provide an OAuth 2.0 client_id and secret. This approach is typically used when an application needs a user to grant it permission to access their BigQuery data.

For more granular control over your interaction with BigQuery, you can of course create your own custom function tools, which are implemented as Python functions that you expose to your agent.

When tools are implemented directly within an agent, even with built-in toolsets, the agent or application is responsible for managing its authentication to BigQuery, as well as the logic and implementation for each tool. This tight coupling creates challenges: updates to a tool or changes in its BigQuery connection method will require manual modification and redeployment for every agent, which can lead to inconsistencies and maintenance overhead.

Option 2: Use BigQuery’s pre-built tools in MCP Toolbox for Databases

The MCP (Model Context Protocol) Toolbox for Databases is an open-source server that centralizes the hosting and management of toolsets, decoupling agentic applications from direct BigQuery interaction. Instead of managing tool logic and authentication themselves, agents act as MCP clients, requesting tools from the Toolbox. The MCP Toolbox handles all the underlying complexities, including secure connections to BigQuery, authentication and query execution.

This centralized approach simplifies tool reuse across multiple agents, streamlines updates (tool logic can be modified and deployed on the Toolbox without requiring changes to every agent), and provides a single point for enforcing security policies.

The MCP Toolbox for Databases natively supports BigQuery’s pre-built toolset. To access these tools, you first need to create a new mcp-toolbox folder in the same directory as your ADK application, and then install the MCP Toolbox:

Set the BIGQUERY_PROJECT environment variable, this represents the project where your BigQuery jobs will be created, executed and billed:

export BIGQUERY_PROJECT=<YOUR_PROJECT_NAME>

Chạy lệnh này để khởi động hộp công cụ và bao gồm bộ công cụ BigQuery:

./toolbox –prebuilt bigquery

Ta cũng có thể  cấu hình MCP client bên trong IDE.

Want to host your own custom tools in MCP Toolbox for Databases?

You can define your own custom tools in SQL within a tools.yaml configuration file and provide the –tools-file option when starting your server. You cannot, however, use the --prebuilt and –tools-file option together. If you want to use custom tools alongside prebuilt tools, you must use the –tool-file option and manually specify the prebuilt tools you want to include in the configuration file, like so.

To connect your ADK application to the MCP Toolbox for Databases, you need to install toolbox-core:

pip install toolbox-core

With your server up and running, you can retrieve your toolset using ToolboxSyncClient and its load_toolset() function:

lang-py

from toolbox_core import ToolboxSyncClient

bigquery_toolbox = ToolboxSyncClient(“http://127.0.0.1:5000”)

bigquery_toolset = bigquery_toolbox.load_toolset()

Run your Conversational Analytics Agent

Assign either the built-in ADK toolset, or the MCP toolset to your agent, and you’re ready to go!

root_agent = Agent(

  model=”gemini-2.0-flash”,

  name=”bigquery_agent”,

  description=(

      “Agent that answers questions about BigQuery data by executing SQL queries”

  ),

  instruction=””” You are a data analysis agent with access to several BigQuery tools. Make use of those tools to answer the user’s questions.

  “””,

  tools=[bigquery_toolset]

)

You can now run your agent using the adk run or adk web command and start asking questions about your data!

Your agent will leverage pre-built tools to extract dataset metadata, and then generate and execute a SQL query in BigQuery to retrieve your result:

Conclusion: Turning the Data Warehouse into an AI Agent “Factory”

The integration of Google BigQuery with the Agent Development Kit (ADK) and Model Customization Platform (MCP) is more than just a feature update, it marks a strategic shift. BigQuery has now moved beyond being a passive data warehouse to becoming a true AI Agent “factory” – where data, development tools, and custom models converge.

By breaking down traditional silos, Google is democratizing the ability to create complex AI agents, empowering developers to create intelligent, deeply customized, contextually aware digital agents faster and more efficiently than ever before. The future of enterprise AI is no longer about moving data to the model, but about bringing the model and tooling to the data.

However, the journey to turn your data warehouse into an intelligent AI Agent “factory” requires deep expertise in both data structure and AI architecture.

Contact Gimasys – Google Cloud Premier Partner today.

With extensive experience in implementing data solutions on BigQuery and AI strategy consulting capabilities, we will help you not only understand, but also maximize the power of the ADK and MCP toolkit, building a solid roadmap to turn data into competitive advantage through exclusive AI Agents.

Back To Top
0974 417 099