tools

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package tools provides functionality for managing MCP tools.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrToolUnavailable    = errors.New("tool is not available")
	ErrServerDisconnected = errors.New("server is disconnected")
	ErrNoConnection       = errors.New("no connection available")
)

Common errors that can occur during MCP tool operations

Functions

func CreateToolHandler

func CreateToolHandler(
	toolName string,
	serverURL string,
	getConnectionState func(string) models.ConnectionState,
	getToolHandlers func() map[string]*RemoteToolInfo,
	checkConnections func(),
) func(context.Context, mcp.CallToolRequest) (*mcp.CallToolResult, error)

CreateToolHandler creates a handler for a remote MCP tool

func HelloHandler

func HelloHandler(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error)

HelloHandler handles the hello_world tool call

Types

type RemoteToolInfo

type RemoteToolInfo struct {
	Tool      mcp.Tool
	ServerURL string
	IsEnabled bool
	HandlerFn func(context.Context, mcp.CallToolRequest) (*mcp.CallToolResult, error)
}

RemoteToolInfo tracks information about a tool from a remote server

Jump to

Keyboard shortcuts

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