tool

package
v0.2.0-0.rc.0 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2025 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package tool provides helpers for discovering and configuring MCP servers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Transport Transport `json:"transport"`
	BaseURL   string    `json:"baseURL"`
}

Config represents an MCP toplevel configuration.

func (Config) Valid

func (c Config) Valid() error

Valid returns no error if the provided Config is valid.

type Option

type Option func(*Resolver)

Option modifies the underlying Resolver.

func WithLogger

func WithLogger(log logging.Logger) Option

WithLogger overrides the underlying logger for the Resolver.

type Resolver

type Resolver struct {
	// contains filtered or unexported fields
}

Resolver is used for resolving MCP server configs from the environment and converting them into langchaingo tools.

func NewResolver

func NewResolver(opts ...Option) *Resolver

NewResolver constructs a Resolver.

func (*Resolver) FromEnvVars

func (r *Resolver) FromEnvVars() map[string]Config

FromEnvVars derives Configs for MCP servers from the environment variables supplied to the process. If the resulting Config is invalid, it is not returned.

func (*Resolver) Resolve

func (r *Resolver) Resolve(ctx context.Context, cfgs map[string]Config) []tools.Tool

Resolve resolves the tools available from the supplied MCP server configurations. If errors occur along the way, the errors are logged and the tools for those servers are not returned.

type Transport

type Transport string

Transport defines specific transport types that are supported.

var (
	// SSE represents Server-Sent Events.
	SSE Transport = "sse"
	// StreamableHTTP represents Streamable HTTP.
	StreamableHTTP Transport = "http-stream"
)

Jump to

Keyboard shortcuts

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