tools

package
v0.0.58 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2026 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CallOptions

type CallOptions struct {
	ProgressToken      any
	LogData            map[string]any
	ReturnInput        bool
	ReturnOutput       bool
	Target             any
	ToolCallInvocation *ToolCallInvocation
	Meta               map[string]any
}

func (CallOptions) Merge

func (o CallOptions) Merge(other CallOptions) (result CallOptions)

type ListToolsOptions

type ListToolsOptions struct {
	Servers []string
	Tools   []string
}

type ListToolsResult

type ListToolsResult struct {
	Server string     `json:"server,omitempty"`
	Tools  []mcp.Tool `json:"tools,omitempty"`
}

type Options added in v0.0.6

type Options struct {
	Roots                     []mcp.Root
	Concurrency               int
	CallbackHandler           mcp.CallbackHandler
	OAuthRedirectURL          string
	TokenStorage              mcp.TokenStorage
	TokenExchangeEndpoint     string
	TokenExchangeClientID     string
	TokenExchangeClientSecret string
	AuditLogCollector         *auditlogs.Collector
}

func (Options) Complete added in v0.0.6

func (r Options) Complete() Options

func (Options) Merge added in v0.0.6

func (r Options) Merge(other Options) (result Options)

type SampleCallOptions

type SampleCallOptions struct {
	ProgressToken any
}

func (SampleCallOptions) Merge

func (s SampleCallOptions) Merge(other SampleCallOptions) (result SampleCallOptions)

type Sampler

type Sampler interface {
	Sample(ctx context.Context, sampling mcp.CreateMessageRequest, opts ...sampling.SamplerOptions) (*types.CallResult, error)
}

type Service

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

func NewToolsService

func NewToolsService(opts ...Options) *Service

func (*Service) AddServer added in v0.0.6

func (s *Service) AddServer(name string, factory func(name string) mcp.MessageHandler)

func (*Service) BuildToolMappings

func (s *Service) BuildToolMappings(ctx context.Context, toolList []string, opts ...types.BuildToolMappingsOptions) (types.ToolMappings, error)

func (*Service) Call

func (s *Service) Call(ctx context.Context, server, tool string, args any, opts ...CallOptions) (ret *types.CallResult, err error)

func (*Service) GetAgentAttributes added in v0.0.46

func (s *Service) GetAgentAttributes(_ context.Context, name string) (agentConfigName string, agentAttribute map[string]any, _ error)

func (*Service) GetClient

func (s *Service) GetClient(ctx context.Context, name string) (*mcp.Client, error)

func (*Service) GetDynamicInstruction

func (s *Service) GetDynamicInstruction(ctx context.Context, instruction types.DynamicInstructions) (string, error)

func (*Service) GetPrompt

func (s *Service) GetPrompt(ctx context.Context, target, prompt string, args map[string]string) (*mcp.GetPromptResult, error)

func (*Service) ListTools

func (s *Service) ListTools(ctx context.Context, opts ...ListToolsOptions) (result []ListToolsResult, _ error)

func (*Service) RunHook added in v0.0.34

func (s *Service) RunHook(ctx context.Context, in, out any, target string) (hasOutput bool, _ error)

func (*Service) SetSampler

func (s *Service) SetSampler(sampler Sampler)

type ToolCallInvocation added in v0.0.6

type ToolCallInvocation struct {
	MessageID string         `json:"messageID,omitempty"`
	ItemID    string         `json:"itemID,omitempty"`
	ToolCall  types.ToolCall `json:"toolCall,omitempty"`
}

Jump to

Keyboard shortcuts

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