mcp

package
v0.0.0-...-2835e8c Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2025 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const MCPURLPath = ".api/mcp/v1"

Variables

This section is empty.

Functions

func BuildArgFlagSet

func BuildArgFlagSet(tool *ToolDef) (*flag.FlagSet, map[string]any, error)

func DerefFlagValues

func DerefFlagValues(fs *flag.FlagSet, vars map[string]any)

Types

type SchemaArray

type SchemaArray struct {
	Type        string      `json:"type"`
	Description string      `json:"description"`
	Items       SchemaValue `json:"items,omitempty"`
}

func (SchemaArray) ValueType

func (s SchemaArray) ValueType() string

type SchemaObject

type SchemaObject struct {
	Type        string                 `json:"type"`
	Description string                 `json:"description"`
	Required    []string               `json:"required,omitempty"`
	Properties  map[string]SchemaValue `json:"properties"`
}

func (SchemaObject) ValueType

func (s SchemaObject) ValueType() string

type SchemaPrimitive

type SchemaPrimitive struct {
	Type        string `json:"type"`
	Description string `json:"description"`
}

func (SchemaPrimitive) ValueType

func (s SchemaPrimitive) ValueType() string

type SchemaValue

type SchemaValue interface {
	ValueType() string
}

type ToolDef

type ToolDef struct {
	Name         string
	RawName      string       `json:"name"`
	Description  string       `json:"description"`
	InputSchema  SchemaObject `json:"inputSchema"`
	OutputSchema SchemaObject `json:"outputSchema"`
}

type ToolRegistry

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

ToolRegistry keeps track of tools and the endpoints they originated from

func NewToolRegistry

func NewToolRegistry() *ToolRegistry

func (*ToolRegistry) All

func (r *ToolRegistry) All() iter.Seq2[string, *ToolDef]

All returns an iterator that yields the name and Tool definition of all registered tools

func (*ToolRegistry) CallTool

func (r *ToolRegistry) CallTool(ctx context.Context, client api.Client, name string, args map[string]any) (map[string]json.RawMessage, error)

CallTool calls the given tool with the given arguments. It constructs the Tool request and decodes the Tool response

func (*ToolRegistry) Get

func (r *ToolRegistry) Get(name string) (*ToolDef, bool)

Get returns the tool definition for the given name

func (*ToolRegistry) LoadTools

func (r *ToolRegistry) LoadTools(ctx context.Context, client api.Client) error

LoadTools loads the tool definitions from the Mcp tool endpoints constants McpURLPath

Jump to

Keyboard shortcuts

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