mcptoolset

package
v0.0.0-...-3906ff0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 13, 2025 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

mcptool package provides MCP adapter, allowing to add MCP tools to LLMAgent.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(cfg Config) (tool.Toolset, error)

New returns MCP ToolSet. MCP ToolSet connects to a MCP Server, retrieves MCP Tools into ADK Tools and passes them to the LLM. It uses https://github.com/modelcontextprotocol/go-sdk for MCP communication. MCP session is created lazily on the first request to LLM.

Usage: create MCP ToolSet with mcptoolset.New() and provide it to the LLMAgent in the llmagent.Config.

Example:

llmagent.New(llmagent.Config{
	Name:        "agent_name",
	Model:       model,
	Description: "...",
	Instruction: "...",
	Toolsets: []tool.Set{
		mcptoolset.New(mcptoolset.Config{
			Transport: &mcp.CommandTransport{Command: exec.Command("myserver")}
		}),
	},
})

Types

type Config

type Config struct {
	// Transport that will be used to connect to MCP server.
	Transport mcp.Transport
	// ToolFilter selects tools for which tool.Predicate returns true.
	// If ToolFilter is nil, then all tools are returned.
	// tool.StringPredicate can be convenient if there's a known fixed list of tool names.
	ToolFilter tool.Predicate
}

Config provides initial configuration for the MCP ToolSet.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL