tools

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateToolHandler

func CreateToolHandler(executor CommandExecutor, cfg *config.ConfigData) func(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error)

CreateToolHandler creates an adapter that converts CommandExecutor to the format expected by MCP server

Types

type CommandExecutor

type CommandExecutor interface {
	Execute(params map[string]interface{}, cfg *config.ConfigData) (string, error)
}

CommandExecutor defines the interface for executing commands This ensures all command executors follow the same pattern and signature

type CommandExecutorFunc

type CommandExecutorFunc func(params map[string]interface{}, cfg *config.ConfigData) (string, error)

CommandExecutorFunc is a function type that implements CommandExecutor This allows regular functions to be used as CommandExecutors without having to create a struct

func (CommandExecutorFunc) Execute

func (f CommandExecutorFunc) Execute(params map[string]interface{}, cfg *config.ConfigData) (string, error)

Execute implements the CommandExecutor interface for CommandExecutorFunc

type ToolHandlerFunc

type ToolHandlerFunc func(params map[string]interface{}, cfg *config.ConfigData) (interface{}, error)

ToolHandlerFunc is a function that processes tool requests Deprecated: Use CommandExecutorFunc instead

Jump to

Keyboard shortcuts

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