mcp

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Serve

func Serve(r io.Reader, w io.Writer, tools []Tool, exec Executor) error

Types

type Executor added in v0.3.0

type Executor func(name string, args []string, flags map[string]string) (string, error)

Executor runs one specd verb and returns its captured stdout. It is injected by the caller (internal/cmd) so the mcp package never imports the dispatcher — that back-edge would be an import cycle, which is why tool execution lived behind the injection seam rather than inside this package.

type Request added in v0.3.0

type Request struct {
	JSONRPC string          `json:"jsonrpc"`
	ID      any             `json:"id,omitempty"`
	Method  string          `json:"method"`
	Params  json.RawMessage `json:"params,omitempty"`
}

type Response added in v0.3.0

type Response struct {
	JSONRPC string         `json:"jsonrpc"`
	ID      any            `json:"id,omitempty"`
	Result  any            `json:"result,omitempty"`
	Error   *ResponseError `json:"error,omitempty"`
}

func Dispatch added in v0.3.0

func Dispatch(req Request, tools []Tool, exec Executor) Response

type ResponseError added in v0.3.0

type ResponseError struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
}

type Tool added in v0.3.0

type Tool struct {
	Name        string         `json:"name"`
	Description string         `json:"description"`
	InputSchema map[string]any `json:"inputSchema"`
}

func BrainTools added in v0.3.0

func BrainTools(config core.Config) []Tool

func CoreTools added in v0.3.0

func CoreTools() []Tool

CoreTools derives the MCP tool palette entirely from core.Command metadata — descriptions and input schemas are generated, never hand-authored, so there is one source of truth and no drift (spec 03 R5, C.8). Flag enums map to JSON Schema `enum` and declared defaults to `default`.

Jump to

Keyboard shortcuts

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