GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • ADK for TypeScript: API Reference

This view

  • Original page
  • New address

GeezerVison is showing adk.dev — AgentRegistrySingleMCPToolset | ADK for TypeScript: API Reference - v2.5.0

  • AgentRegistrySingleMCPToolset

Class AgentRegistrySingleMCPToolset

A specialized BaseToolset subclass designed to represent a single registered MCP server.

Unlike a standard MCPToolset, this class:

  1. Supports a dynamic headerProvider to fetch/refresh authorization and custom headers immediately before establishing the MCP connection session.
  2. Automatically injects the special gcp.mcp.server.destination.id telemetry metadata identifier into all resolved tools' custom metadata, allowing downstream execute_tool traces to be correctly attributed.

Hierarchy (View Summary)

  • BaseToolset
    • AgentRegistrySingleMCPToolset
  • Defined in core/src/integrations/agent_registry/agent_registry_mcp_toolset.ts:31

Constructors

constructor

  • new AgentRegistrySingleMCPToolset(
        options: {
            authCredential?: AuthCredential;
            authScheme?: AuthScheme;
            connectionParams: StreamableHTTPConnectionParams;
            destinationResourceId?: string;
            headerProvider?: (
                context?: ReadonlyContext,
            ) => Record<string, string> | Promise<Record<string, string>>;
            prefix?: string;
            toolFilter?:
                | string[]
                | ((tool: BaseTool, readonlyContext?: ReadonlyContext) => boolean);
        },
    ): AgentRegistrySingleMCPToolset

    Parameters

    • options: {
          authCredential?: AuthCredential;
          authScheme?: AuthScheme;
          connectionParams: StreamableHTTPConnectionParams;
          destinationResourceId?: string;
          headerProvider?: (
              context?: ReadonlyContext,
          ) => Record<string, string> | Promise<Record<string, string>>;
          prefix?: string;
          toolFilter?:
              | string[]
              | ((tool: BaseTool, readonlyContext?: ReadonlyContext) => boolean);
      }

      Configuration for the MCP toolset.

      • OptionalauthCredential?: AuthCredential

        Optional credential forwarded to each resolved tool.

      • OptionalauthScheme?: AuthScheme

        Optional auth scheme forwarded to each resolved tool.

      • connectionParams: StreamableHTTPConnectionParams

        HTTP connection parameters for the MCP server.

      • OptionaldestinationResourceId?: string

        Telemetry identifier injected as gcp.mcp.server.destination.id into each resolved tool's custom metadata.

      • OptionalheaderProvider?: (
            context?: ReadonlyContext,
        ) => Record<string, string> | Promise<Record<string, string>>

        Optional async function called immediately before each getTools invocation to supply or refresh request headers (e.g. GCP auth tokens).

      • Optionalprefix?: string

        Optional prefix prepended to each tool name (e.g. myServer_toolName).

      • OptionaltoolFilter?: string[] | ((tool: BaseTool, readonlyContext?: ReadonlyContext) => boolean)

        Optional predicate or list of tool names to include. When omitted, all tools from the server are returned.

    Returns AgentRegistrySingleMCPToolset

    Overrides BaseToolset.constructor

    • Defined in core/src/integrations/agent_registry/agent_registry_mcp_toolset.ts:53

Properties

Readonly[BASE_TOOLSET_SIGNATURE_SYMBOL]

"[BASE_TOOLSET_SIGNATURE_SYMBOL]": true

Inherited from BaseToolset.[BASE_TOOLSET_SIGNATURE_SYMBOL]

  • Defined in core/src/tools/base_toolset.ts:42

Optional ReadonlyauthCredential

authCredential?: AuthCredential
  • Defined in core/src/integrations/agent_registry/agent_registry_mcp_toolset.ts:38

Optional ReadonlyauthScheme

authScheme?: AuthScheme
  • Defined in core/src/integrations/agent_registry/agent_registry_mcp_toolset.ts:37

ReadonlyconnectionParams

connectionParams: StreamableHTTPConnectionParams
  • Defined in core/src/integrations/agent_registry/agent_registry_mcp_toolset.ts:33

Optional ReadonlydestinationResourceId

destinationResourceId?: string
  • Defined in core/src/integrations/agent_registry/agent_registry_mcp_toolset.ts:32

Optional ReadonlyheaderProvider

headerProvider?: (
    context?: ReadonlyContext,
) => Record<string, string> | Promise<Record<string, string>>
  • Defined in core/src/integrations/agent_registry/agent_registry_mcp_toolset.ts:34

Optional Readonlyprefix

prefix?: string

Inherited from BaseToolset.prefix

  • Defined in core/src/tools/base_toolset.ts:46

ReadonlytoolFilter

toolFilter:
    | string[]
    | ((tool: BaseTool, readonlyContext?: ReadonlyContext) => boolean) = []

Inherited from BaseToolset.toolFilter

  • Defined in core/src/tools/base_toolset.ts:45

Methods

close

  • close(): Promise<void>

    Closes the toolset.

    NOTE: This method is invoked, for example, at the end of an agent server's lifecycle or when the toolset is no longer needed. Implementations should ensure that any open connections, files, or other managed resources are properly released to prevent leaks.

    Returns Promise<void>

    A Promise that resolves when the toolset is closed.

    Overrides BaseToolset.close

    • Defined in core/src/integrations/agent_registry/agent_registry_mcp_toolset.ts:154

getTools

  • getTools(context?: ReadonlyContext): Promise<BaseTool[]>

    Connects to the underlying MCP server, retrieves tool definitions, prefixes tool names, and injects destination telemetry metadata into each tool.

    The headerProvider, if configured, is invoked immediately before the connection is established so that tokens are always fresh.

    Parameters

    • Optionalcontext: ReadonlyContext

      Optional readonly agent context passed to the header provider.

    Returns Promise<BaseTool[]>

    The resolved and optionally filtered list of MCPTool instances.

    Overrides BaseToolset.getTools

    • Defined in core/src/integrations/agent_registry/agent_registry_mcp_toolset.ts:82

ProtectedisToolSelected

  • isToolSelected(tool: BaseTool, context?: ReadonlyContext): boolean

    Returns whether the tool should be exposed to LLM.

    Parameters

    • tool: BaseTool

      The tool to check.

    • Optionalcontext: ReadonlyContext

      Context used to filter tools available to the agent.

    Returns boolean

    Whether the tool should be exposed to LLM.

    Inherited from BaseToolset.isToolSelected

    • Defined in core/src/tools/base_toolset.ts:77

processLlmRequest

  • processLlmRequest(_toolContext: Context, _llmRequest: LlmRequest): Promise<void>

    Processes the outgoing LLM request for this toolset. This method will be called before each tool processes the llm request.

    Use cases:

    • Instead of let each tool process the llm request, we can let the toolset process the llm request. e.g. ComputerUseToolset can add computer use tool to the llm request.

    Parameters

    • _toolContext: Context

      The context of the tool.

    • _llmRequest: LlmRequest

      The outgoing LLM request, mutable this method.

    Returns Promise<void>

    Inherited from BaseToolset.processLlmRequest

    • Defined in core/src/tools/base_toolset.ts:109
Constructors
constructor
Properties
[BASE_TOOLSET_SIGNATURE_SYMBOL]authCredentialauthSchemeconnectionParamsdestinationResourceIdheaderProviderprefixtoolFilter
Methods
closegetToolsisToolSelectedprocessLlmRequest
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.