MCP Toolbox Go SDK — Tbadk (v1.0.0)

import "github.com/googleapis/mcp-toolbox-sdk-go/tbadk"

Index

Constants

Version is the current version of the library. This is updated automatically by release-please.

const Version = "1.0.0" // x-release-please-version

type ToolboxClient

The MCP Toolbox for Databases Client.

type ToolboxClient struct {
    *core.ToolboxClient
}

func NewToolboxClient

func NewToolboxClient(url string, opts ...core.ClientOption) (ToolboxClient, error)

NewToolboxClient creates and configures a new, immutable client for interacting with a Toolbox server.

Inputs:

  • url: The base URL of the Toolbox server.
  • opts: A variadic list of core.ClientOption functions to configure the client, such as setting a custom http.Client or default headers.

Returns:

A configured ToolboxClient and a nil error on success, or an empty client
and an error if configuration fails.

func (ToolboxClient) LoadTool

func (tc ToolboxClient) LoadTool(name string, ctx context.Context, opts ...core.ToolOption) (ToolboxTool, error)

LoadTool fetches a single tool from the Toolbox server

Inputs:

  • name: The specific name of the tool to load.
  • ctx: The context to control the lifecycle of the request.
  • opts: A variadic list of ToolOption functions to configure auth tokens or bind parameters for this tool.

Returns:

A configured *ToolboxTool and a nil error on success, or an empty tool and
an error if loading or validation fails.

func (ToolboxClient) LoadToolset

func (tc ToolboxClient) LoadToolset(name string, ctx context.Context, opts ...core.ToolOption) ([]ToolboxTool, error)

LoadToolset fetches a collection of tools from the Toolbox server

Inputs:

  • name: Name of the toolset to be loaded.Set this arg to "" to load the default toolset
  • ctx: The context to control the lifecycle of the request.
  • opts: A variadic list of ToolOption functions. These can include WithStrict and options for auth or bound params that may apply to tools in the set.

Returns:

A slice of configured *ToolboxTool and a nil error on success, or a nil
slice and an error if loading or validation fails.

type ToolboxTool

type ToolboxTool struct {
    *core.ToolboxTool
    // contains filtered or unexported fields
}

func (ToolboxTool) Declaration

func (tt ToolboxTool) Declaration() *genai.FunctionDeclaration

Declaration returns the tool’s function declaration.

func (ToolboxTool) IsLongRunning

func (tt ToolboxTool) IsLongRunning() bool

IsLongRunning indicates whether the tool is a long-running operation TBADK will not support long running tools for now

func (ToolboxTool) ProcessRequest

func (tt ToolboxTool) ProcessRequest(ctx agent.Context, req *model.LLMRequest) error

This function is copied from ADK Go if there is already a tool with a function declaration, it appends another to it; otherwise, it creates a new genai tool.

func (ToolboxTool) Run

func (tt ToolboxTool) Run(ctx agent.Context, args any) (result map[string]any, err error)

Run executes the tool with the given input.

Inputs:

  • ctx: The tool context to control the lifecycle of the API request.
  • args: A map of parameter names to values provided by the user for this specific invocation.

Returns:

The result from the API call, in the form of a map[string]any with the result
in the 'output' field.

func (ToolboxTool) ToolFrom

func (tt ToolboxTool) ToolFrom(opts ...core.ToolOption) (ToolboxTool, error)

ToolFrom creates a new, more specialized tool from an existing one by applying additional options. This is useful for creating variations of a tool with different bound parameters / auth tokens without modifying the original and all provided options must be applicable.

Inputs:

  • opts: A variadic list of ToolOption functions to further configure the new tool, such as binding more parameters.

Returns:

A new, specialized ToolboxTool and a nil error, or an empty tool and an
error if the new options are invalid or conflict with existing settings.

Generated by gomarkdoc