tools

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2026 License: MIT Imports: 11 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package tools defines the MCP tool surface exposed to the agent.

Every tool is declared as data (name, description, JSON Schema, handler) and adapted to the MCP SDK at registration time. That keeps the 40-odd tools uniform: one place enforces read-only mode, argument decoding, JSON result encoding, and credential redaction.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Instructions

func Instructions(version, upstream string) string

Instructions is the server-level guidance handed to the agent on connect.

func RegisterAll

func RegisterAll(s *mcp.Server, r *Registry)

RegisterAll builds the full tool set and attaches it to the MCP server.

Types

type Args

type Args map[string]any

Args is the decoded tool argument map.

type Handler

type Handler func(ctx context.Context, a Args) (any, error)

Handler implements one tool. Returning an error surfaces as a protocol error; returning a value encodes it as the tool's JSON result.

type Registry

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

Registry holds the tool set and the shared upstream client.

func NewRegistry

func NewRegistry(c *client.Client, quotaPerUnit float64) *Registry

NewRegistry builds an empty registry bound to c.

func (*Registry) Add

func (r *Registry) Add(ts ...Tool)

Add appends tools.

func (*Registry) Attach

func (r *Registry) Attach(s *mcp.Server)

Attach registers every tool with the MCP server.

func (*Registry) Tools

func (r *Registry) Tools() []Tool

Tools returns the registered tools.

type Tool

type Tool struct {
	Name        string
	Title       string
	Description string
	Schema      map[string]any
	// Mutating marks write operations; the server refuses them in read-only mode.
	Mutating bool
	Handler  Handler
}

Tool is one MCP tool definition.

Jump to

Keyboard shortcuts

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