local

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Backend

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

Backend implements the backend.Backend interface for local tool handlers.

func New

func New(name string) *Backend

New creates a new local backend.

func (*Backend) Enabled

func (b *Backend) Enabled() bool

Enabled returns whether the backend is enabled.

func (*Backend) Execute

func (b *Backend) Execute(ctx context.Context, tool string, args map[string]any) (any, error)

Execute invokes a tool handler.

func (*Backend) Kind

func (b *Backend) Kind() string

Kind returns the backend kind.

func (*Backend) ListTools

func (b *Backend) ListTools(_ context.Context) ([]model.Tool, error)

ListTools returns tools available from this backend.

func (*Backend) Name

func (b *Backend) Name() string

Name returns the backend instance name.

func (*Backend) RegisterHandler

func (b *Backend) RegisterHandler(name string, def ToolDef)

RegisterHandler registers a tool handler.

func (*Backend) SetEnabled

func (b *Backend) SetEnabled(enabled bool)

SetEnabled enables or disables the backend.

func (*Backend) Start

func (b *Backend) Start(_ context.Context) error

Start initializes the backend (no-op for local backend).

func (*Backend) Stop

func (b *Backend) Stop() error

Stop stops the backend (no-op for local backend).

func (*Backend) UnregisterHandler

func (b *Backend) UnregisterHandler(name string)

UnregisterHandler removes a tool handler.

type HandlerFunc

type HandlerFunc func(ctx context.Context, args map[string]any) (any, error)

HandlerFunc is the function signature for tool handlers.

type ToolDef

type ToolDef struct {
	Name         string
	Title        string
	Description  string
	InputSchema  map[string]any
	OutputSchema map[string]any
	Annotations  *mcp.ToolAnnotations
	Tags         []string
	Handler      HandlerFunc
}

ToolDef defines a local tool with its handler.

Jump to

Keyboard shortcuts

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