Help us shape the future of Go! Take the 2026 Go Developer Survey

mcptools

package
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Overview

Package mcptools connects explicitly configured local MCP servers.

Index

Constants

View Source
const (
	ListResourcesTool = "list_mcp_resources"
	ReadResourceTool  = "read_mcp_resource"
)

The read-only resource tools, offered when some server has a resources allowlist.

View Source
const MaxImagesPerResult = 8

MaxImagesPerResult caps how many images one MCP result may pass through; later images get an omission marker.

View Source
const MaxServers = maxServers

MaxServers is the most MCP servers one run may start, counting configured and plugin servers together.

Variables

This section is empty.

Functions

func CheckSchema added in v0.5.0

func CheckSchema(v any) (map[string]any, error)

CheckSchema applies the JSON Schema subset accepted for MCP tool input schemas to v: a root object, the supported keywords and types only, and the size and nesting caps. It returns the schema with "$schema" dropped.

Types

type Registry

type Registry struct {
	Specs []model.ToolSpec

	// Log, when set, gets one line per read_mcp_resource call (-v).
	Log io.Writer
	// contains filtered or unexported fields
}

func Start

func Start(ctx context.Context, root string, cfg []config.MCPServer, stderr io.Writer) (*Registry, error)

Start validates and connects all configured servers, building a fixed catalog.

func (*Registry) Call

func (r *Registry) Call(ctx context.Context, name, raw string) (out string, isErr, ok bool)

Call executes only a catalogued tool, preserving the original JSON values. ok is false when name is not catalogued; isErr marks a failed call.

func (*Registry) CallImages added in v0.5.0

func (r *Registry) CallImages(maxImageBytes int) func(ctx context.Context, name, raw string) (string, []model.Image, bool, bool)

CallImages is Call with image pass-through (--images): each PNG, JPEG, GIF, or WebP image of at most maxImageBytes is returned as an image, and the text gets its placeholder in the image's position. Other images get a specific omission marker.

func (*Registry) Close

func (r *Registry) Close()

type Tool

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

Jump to

Keyboard shortcuts

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