Documentation
¶
Overview ¶
Package mcp serves the platform over the Model Context Protocol.
It is a presentation layer and nothing else, in the same sense that the cobra command tree and an HTTP handler are: it translates one wire protocol into calls on pkg/leaflow and translates the answers back. What an operation is, what it accepts, whether an argument is valid, where the request goes — none of that is decided here, so a tool cannot drift from a command.
The one thing this layer does decide is shape, and it is the reason MCP is worth having over the command line: a tool call is already JSON. A shell spends real effort flattening a request body into one flag per field; here the contract's schema is handed to the client as it stands, nesting intact, under the contract's own names.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrUnknownMode = errors.New("unknown tool mode")
var Modes = []string{ string(ModeMeta), string(ModeOperations), }
Functions ¶
This section is empty.
Types ¶
type Mode ¶
type Mode string
Mode decides how the two hundred operations are presented.
This is the one question this surface has that a command line does not. A shell can hold every command because nobody reads them all; a model is sent the whole tool list on every turn, and a list that large crowds out the conversation it is meant to serve.
const ( // ModeMeta exposes four fixed tools and lets the client walk the contracts // through them. Context cost does not grow with the platform. ModeMeta Mode = "meta" // ModeOperations exposes one tool per operation, which is what clients are // built for — names complete, schemas visible without a call — and is usable // once Services narrows it to a service or two. ModeOperations Mode = "operations" )
type Options ¶
type Options struct {
// Client is the platform. Its credentials, services and read-only setting
// are already decided; this server does not second-guess any of them.
Client *leaflow.Client
// Version is reported to the client as the server's.
Version string
Mode Mode
}
Options is one server's configuration.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func (*Server) Handler ¶
Handler serves the same server over HTTP.
One sdk.Server backs every session rather than one per request: the tools come from contracts that do not change while the process runs.