
Step 2: Define Your Tools (tools.yaml)
The MCP Toolbox for Databases requires a file called tools.yaml, which is a YAML file that defines which database you’re connecting to and which SQL queries will be exposed as tools. These tools query the cloud_pricing_export table, abstracting schema complexity and enabling secure, parameterized access for the PricingBot agent.
sources:
billing-pricing-bq:
kind: bigquery
project: your_project_idtools:
list_services:
kind: bigquery-sql
source: billing-pricing-bq
description: Lists all available Google Cloud services in the pricing catalog.
statement: |
SELECT DISTINCT service.description
FROM `your_dataset_id`
ORDER BY service.description
We start off by declaring our sources for the tools file following by declaring our first tool list_services. The list_services tool queries the cloud_pricing_export table to retrieve a list of all Google Cloud services (e.g., BigQuery, Compute Engine) available on a specified date.
It simplifies discovery by providing a starting point for users to explore services without writing SQL, addressing the dead data problem by making the billing catalog accessible.
list_skus_for_service:
kind: bigquery-sql
source: billing-pricing-bq
description: Lists up to 20 SKUs for a given Google Cloud service.
parameters:
- name: service_name
type: string
description: The name of the service (case-insensitive).
statement: |
SELECT
sku.id,
sku.description,
service.description as service_name
FROM
`your_dataset_id`
WHERE
LOWER(service.description) = LOWER(@service_name)
ORDER BY
sku.description
LIMIT 20
The list_skus_for_service tool lists up to 20 SKUs for a given Google Cloud service (e.g., Cloud Storage) on a specified date. It includes SKU IDs, descriptions, and CUD eligibility, simplifying service-specific pricing exploration and turning dead data into a navigable resource.
list_skus_for_service_and_region:
kind: bigquery-sql
source: billing-pricing-bq
description: Lists up to 20 SKUs for a given Google Cloud service in a specific region.
parameters:
- name: service_name
type: string
description: The name of the service (case-insensitive).
- name: region
type: string
description: The region to filter by (e.g., 'us-east1').
statement: |
SELECT
sku.id,
sku.description,
service.description as service_name,
geo_taxonomy.regions
FROM
`your_dataset_id`
WHERE
LOWER(service.description) = LOWER(@service_name)
AND @region IN UNNEST(geo_taxonomy.regions)
ORDER BY
sku.description
LIMIT 20
The list_skus_for_service_and_region tool fetches up to 20 SKUs for a service in a specific region (e.g., us-east1) on a given date. It includes CUD indicators, enabling region-specific pricing queries and making dead data actionable for targeted analysis.
get_sku_pricing:
kind: bigquery-sql
source: billing-pricing-bq
description: Retrieves the pricing information for a specific SKU.
parameters:
- name: sku_id
type: string
description: The ID of the SKU.
statement: |
SELECT
sku.id,
sku.description,
service.description as service_name,
pricing_unit,
list_price,
account_currency_code
FROM
`your_dataset_id`
WHERE
sku.id = @sku_id
The get_sku_pricing tool retrieves detailed pricing for a specific SKU, including tiered rates, USD, and local currency amounts, on a given date. It supports tiered pricing explanations and CUD detection, transforming dead data into clear, actionable insights.
toolsets:
billing-pricing-tools-v4:
- list_services
- list_skus_for_service
- list_skus_for_service_and_region
- get_sku_pricing
In the end we collect all our tools and list them under one toolset.
Run the Toolbox Server
./toolbox --tools-file="tools.yaml"
Now, your billing database is ready to talk.
Step 3: Build the ADK-powered Agent
With the MCP Toolbox configured to provide secure, parameterized access to the cloud_pricing_export table, the next step is to build the ADK agent, PricingBotV4, using the Agent Development Kit (ADK).
This agent integrates with the MCP tools to enable conversational queries, transforming dead billing data into a dynamic, user-friendly resource. The agent uses Google Cloud’s generative AI capabilities (e.g., Gemini 2.0 Flash model) to reason over data and follow predefined workflows for tasks like listing SKUs, retrieving pricing, explaining tiered rates, handling currency conversions, and detecting Committed Use Discounts (CUDs).
from google.adk.agents import Agent
from toolbox_core import ToolboxSyncClienttoolbox = ToolboxSyncClient("http://127.0.0.1:5000")
# Load all the tools
tools = toolbox.load_toolset('billing-pricing-tools-v4')
This code imports the libraries needed to build the agent and connects to the MCP Toolbox server, loading the billing-pricing-tools-v4 toolset. It sets up secure access to BigQuery billing data, eliminating the need for manual API setup or authentication, making dead data accessible.
This segment creates the PricingBotV4 agent using the Agent class from ADK, configuring it with the gemini-2.0-flash model for natural language processing and reasoning.
The description field positions it as a Google Cloud pricing expert, while the instruction provides detailed workflows to handle various query types: listing SKUs (with or without region filters), retrieving pricing, explaining tiered rates (by inspecting list_price.tiered_rates), handling currency conversions (using account_currency_amount), detecting CUDs (via “Commitment” in SKU descriptions), and providing service pricing overviews.
The tools parameter links to the MCP toolset (billing-pricing-tools-v4), enabling secure BigQuery queries. This setup addresses dead data by abstracting complex SQL (e.g., unnesting arrays, filtering partitions) and security concerns (e.g., IAM, VPC rules), allowing users to ask natural questions like —
What’s the price of SKU 578C-5A2A-71EF in INR? and receive clear, formatted responses (e.g., “$0.05/hour, INR ~4.38/hour, not tiered”).
The workflows ensure consistency and accuracy, transforming inaccessible billing data into a dynamic resource for users and enterprises.
Run and Test the Agent
To run locally, start the MCP Toolbox for Databases server and execute adk web. For production, deploy to Vertex AI Agent Engine or Cloud Run for scalability. This setup enables conversational queries, turning dead billing data into actionable insights without manual SQL or API hassles.
Test the agent with queries like List services on 2025–09–01 or Get pricing for SKU 578C-5A2A-71EF in INR. These validate its ability to list SKUs, explain pricing, handle currencies, and flag CUDs, making billing data accessible without SQL expertise. Ensure the server is running, permissions are set, and views handle schema changes, keeping billing data accessible.
Source Credit: https://medium.com/google-cloud/build-a-google-cloud-finops-assistant-agent-with-adk-mcp-toolbox-for-databases-764dc463a5dc?source=rss—-e52cf94d98af—4