serve

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildInputSchema

func BuildInputSchema(action ActionSchema) map[string]any

BuildInputSchema converts an ActionSchema's field definitions into a JSON Schema object (as map[string]any) suitable for mcp.Tool.InputSchema. All fields are typed as "string" with a description from the map value.

func MakeToolHandler

func MakeToolHandler(f *cmdutil.Factory, actionType string) mcp.ToolHandler

MakeToolHandler returns a ToolHandler that POSTs to /api/execute/{actionType} with the tool call arguments as the JSON body.

func NewServeCmd

func NewServeCmd(f *cmdutil.Factory) *cobra.Command

func RegisterTools

func RegisterTools(server *mcp.Server, f *cmdutil.Factory) error

RegisterTools fetches the /api/mcp/schemas endpoint and registers one MCP tool per action. Tool names use underscore separators (e.g. "web3_transfer"). If the schemas fetch fails, a warning is logged to stderr and the server starts with zero tools -- this is intentional per design.

Types

type ActionSchema

type ActionSchema struct {
	ActionType          string            `json:"actionType"`
	Label               string            `json:"label"`
	Description         string            `json:"description"`
	Category            string            `json:"category"`
	Integration         string            `json:"integration"`
	RequiresCredentials bool              `json:"requiresCredentials"`
	RequiredFields      map[string]string `json:"requiredFields"`
	OptionalFields      map[string]string `json:"optionalFields"`
	OutputFields        map[string]string `json:"outputFields"`
}

ActionSchema describes a single action available from the MCP schemas endpoint.

type SchemasResponse

type SchemasResponse struct {
	Actions map[string]ActionSchema `json:"actions"`
}

SchemasResponse is the correct shape of the /api/mcp/schemas response. The Actions field is a map keyed by actionType (e.g. "web3/check-balance"). NOTE: This is intentionally separate from cmd/protocol/list.go which uses a different (incorrect) response shape for the protocol discovery commands.

Jump to

Keyboard shortcuts

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