Skip to content

MCP Toolbox for Databases tool for ADK

Supported in ADKPythonTypescriptGo

MCP Toolbox for Databases is an open source MCP server for databases. It was designed with enterprise-grade and production-quality in mind. It enables you to develop tools easier, faster, and more securely by handling the complexities such as connection pooling, authentication, and more.

Google’s Agent Development Kit (ADK) has built in support for Toolbox. For more information on getting started or configuring Toolbox, see the documentation.

MCP Toolbox for Databases

Supported Data Sources

MCP Toolbox provides out-of-the-box toolsets for the following databases and data platforms:

Google Cloud

Relational & SQL Databases

NoSQL & Key-Value Stores

Graph Databases

  • Neo4j (with tools for Cypher queries and schema inspection)
  • Dgraph

Data Platforms & Federation

  • Looker (for running Looks, queries, and building dashboards via the Looker API)
  • Trino (for running federated queries across multiple sources)

Other

Configure and deploy

Toolbox is an open source server that you deploy and manage yourself. For more instructions on deploying and configuring, see the official Toolbox documentation:

Install Client SDK for ADK

ADK relies on the toolbox-adk python package to use Toolbox. Install the package before getting started:

pip install google-adk[toolbox]

Loading Toolbox Tools

Once your Toolbox server is configured, up and running, you can load tools from your server using ADK:

from google.adk.agents import Agent
from google.adk.tools.toolbox_toolset import ToolboxToolset

toolset = ToolboxToolset(
    server_url="http://127.0.0.1:5000"
)

root_agent = Agent(
    ...,
    tools=[toolset] # Provide the toolset to the Agent
)

Authentication

The ToolboxToolset supports various authentication strategies including Workload Identity (ADC), User Identity (OAuth2), and API Keys. For full documentation, see the Toolbox ADK Authentication Guide.

Example: Workload Identity (ADC)

Recommended for Cloud Run, GKE, or local development with gcloud auth login.

from google.adk.tools.toolbox_toolset import ToolboxToolset
from toolbox_adk import CredentialStrategy

# target_audience: The URL of your Toolbox server
creds = CredentialStrategy.workload_identity(target_audience="<TOOLBOX_URL>")

toolset = ToolboxToolset(
    server_url="<TOOLBOX_URL>",
    credentials=creds
)

Advanced Configuration

You can configure parameter binding, request hooks, and additional headers. See the Toolbox ADK documentation for details.

Parameter Binding

Bind values to tool parameters globally. These values are hidden from the model.

toolset = ToolboxToolset(
    server_url="...",
    bound_params={
        "region": "us-central1",
        "api_key": lambda: get_api_key() # Can be a callable
    }
)

Usage with Hooks

Attach pre_hook and post_hook functions to execute logic before and after tool invocation.

async def log_start(context, args):
    print(f"Starting tool with args: {args}")

toolset = ToolboxToolset(
    server_url="...",
    pre_hook=log_start
)

ADK relies on the @toolbox-sdk/adk TS package to use Toolbox. Install the package before getting started:

npm install @toolbox-sdk/adk

Loading Toolbox Tools

Once you’re Toolbox server is configured and up and running, you can load tools from your server using ADK:

import {InMemoryRunner, LlmAgent} from '@google/adk';
import {Content} from '@google/genai';
import {ToolboxClient} from '@toolbox-sdk/adk'

const toolboxClient = new ToolboxClient("http://127.0.0.1:5000");
const loadedTools = await toolboxClient.loadToolset();

export const rootAgent = new LlmAgent({
  name: 'weather_time_agent',
  model: 'gemini-2.5-flash',
  description:
    'Agent to answer questions about the time and weather in a city.',
  instruction:
    'You are a helpful agent who can answer user questions about the time and weather in a city.',
  tools: loadedTools,
});

async function main() {
  const userId = 'test_user';
  const appName = rootAgent.name;
  const runner = new InMemoryRunner({agent: rootAgent, appName});
  const session = await runner.sessionService.createSession({
    appName,
    userId,
  });

  const prompt = 'What is the weather in New York? And the time?';
  const content: Content = {
    role: 'user',
    parts: [{text: prompt}],
  };
  console.log(content);
  for await (const e of runner.runAsync({
    userId,
    sessionId: session.id,
    newMessage: content,
  })) {
    if (e.content?.parts?.[0]?.text) {
      console.log(`${e.author}: ${JSON.stringify(e.content, null, 2)}`);
    }
  }
}

main().catch(console.error);

ADK relies on the mcp-toolbox-sdk-go go module to use Toolbox. Install the module before getting started:

go get github.com/googleapis/mcp-toolbox-sdk-go

Loading Toolbox Tools

Once you’re Toolbox server is configured and up and running, you can load tools from your server using ADK:

package main

import (
    "context"
    "fmt"

    "github.com/googleapis/mcp-toolbox-sdk-go/tbadk"
    "google.golang.org/adk/agent/llmagent"
)

func main() {

  toolboxClient, err := tbadk.NewToolboxClient("https://127.0.0.1:5000")
    if err != nil {
        log.Fatalf("Failed to create MCP Toolbox client: %v", err)
    }

  // Load a specific set of tools
  toolboxtools, err := toolboxClient.LoadToolset("my-toolset-name", ctx)
  if err != nil {
    return fmt.Sprintln("Could not load Toolbox Toolset", err)
  }

  toolsList := make([]tool.Tool, len(toolboxtools))
    for i := range toolboxtools {
      toolsList[i] = &toolboxtools[i]
    }

  llmagent, err := llmagent.New(llmagent.Config{
    ...,
    Tools:       toolsList,
  })

  // Load a single tool
  tool, err := client.LoadTool("my-tool-name", ctx)
  if err != nil {
    return fmt.Sprintln("Could not load Toolbox Tool", err)
  }

  llmagent, err := llmagent.New(llmagent.Config{
    ...,
    Tools:       []tool.Tool{&toolboxtool},
  })
}

Advanced Toolbox Features

Toolbox has a variety of features to make developing Gen AI tools for databases. For more information, read more about the following features:

  • Authenticated Parameters: bind tool inputs to values from OIDC tokens automatically, making it easy to run sensitive queries without potentially leaking data
  • Authorized Invocations: restrict access to use a tool based on the users Auth token
  • OpenTelemetry: get metrics and tracing from Toolbox with OpenTelemetry