Documentation
¶
Overview ¶
Package mcpserver is the JSON-RPC of the runtime's MCP server for agents: stateless Streamable HTTP, every POST carrying one message (or a batch) and getting its answer as plain JSON, nothing kept between calls. The tools come from toolsets (the preview's DevTools, the conversations an agent delegates), each answering for its own names.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func TextResult ¶
TextResult is a tools/call result of one text.
func ToolsListChanged ¶
func ToolsListChanged() []byte
ToolsListChanged is the notification a server with ListChanged sends when its tools change.
Types ¶
type Server ¶
type Server struct {
// Name is the name the server announces.
Name string
Sets []Toolset
// OnCall, when set, is told every tool call with how long it took and its result (the journal).
OnCall func(ctx context.Context, tool string, took time.Duration, result *jsvalue.Object)
// ListChanged says the server tells its clients when its tools change (notifications/tools/list_changed on the GET
// stream of Streamable HTTP, which the server's route keeps), so they ask tools/list again.
ListChanged bool
}
Server answers the JSON-RPC messages of its toolsets, in their order.
type Toolset ¶
type Toolset interface {
// Instructions is what the server tells the agent of these tools at initialize.
Instructions() string
// Tools are the tools' definitions as tools/list gives them.
Tools() []any
Has(name string) bool
// Call runs a tool the set has with its arguments (an object, empty when none were given): the tools/call result.
Call(ctx context.Context, name string, args *jsvalue.Object) *jsvalue.Object
}
Toolset is a group of tools of the server.