Documentation
¶
Index ¶
Constants ¶
const ( // JSON-RPC 2.0 well-known error codes. CodeParseError = -32700 CodeInvalidRequest = -32600 CodeMethodNotFound = -32601 CodeInvalidParams = -32602 CodeInternalError = -32603 // Application error codes live in the JSON-RPC server error range. CodeForbidden = -32003 CodeNotFound = -32004 )
Variables ¶
var AgentTools = []Tool{ { Name: "get_bundle", Description: "Fetch the incident triage bundle for this agent session.", InputSchema: objectSchema(nil, nil), }, { Name: "get_context", Description: "Fetch scoped incident context: failing logs, run history, or why output.", InputSchema: objectSchema(map[string]any{ "kind": map[string]any{ "type": "string", "description": "Context kind to fetch.", "enum": []string{"logs", "history", "why"}, }, "job": map[string]any{ "type": "string", "description": "Optional job alias for history; must be in the incident allowlist unless it is the incident job.", }, "task": map[string]any{ "type": "string", "description": "Task name for why context.", }, }, []string{"kind"}), }, { Name: "propose_action", Description: "Propose or execute a typed remediation action through Caesium's server-side executor.", InputSchema: objectSchema(map[string]any{ "type": map[string]any{ "type": "string", "description": "Typed remediation action name.", }, "params": map[string]any{ "type": "object", "description": "Action-specific parameters.", }, }, []string{"type"}), }, { Name: "add_note", Description: "Append a free-text finding to the incident timeline.", InputSchema: objectSchema(map[string]any{ "text": map[string]any{ "type": "string", "description": "Timeline note text.", }, }, []string{"text"}), }, }
AgentTools are the four Caesium agent tools exposed over MCP. The incident id is intentionally absent: it comes only from /v1/agent/incidents/:id/mcp.
Functions ¶
This section is empty.
Types ¶
type Capabilities ¶
Capabilities advertises supported MCP server capabilities.
type Dispatcher ¶
type Dispatcher struct {
Tools []Tool
CallTool ToolHandler
ReservedParamFields []string
}
Dispatcher handles MCP's JSON-RPC methods over one synchronous HTTP POST.
func (Dispatcher) Dispatch ¶
func (d Dispatcher) Dispatch(req Request) Response
Dispatch handles initialize, tools/list, and tools/call.
type Error ¶
Error is the JSON-RPC 2.0 error object.
func InternalError ¶
func InternalError() *Error
InternalError returns a JSON-RPC internal-error response with a stable message.
func InvalidParams ¶
InvalidParams returns a JSON-RPC invalid-params error.
type InitializeResult ¶
type InitializeResult struct {
ProtocolVersion string `json:"protocolVersion"`
Capabilities Capabilities `json:"capabilities"`
ServerInfo ServerInfo `json:"serverInfo"`
}
InitializeResult is the MCP initialize response payload.
type ListToolsResult ¶
type ListToolsResult struct {
Tools []Tool `json:"tools"`
}
ListToolsResult is the tools/list response payload.
type Request ¶
type Request struct {
JSONRPC string `json:"jsonrpc"`
ID json.RawMessage `json:"id,omitempty"`
Method string `json:"method"`
Params json.RawMessage `json:"params,omitempty"`
}
Request is the JSON-RPC 2.0 envelope accepted by the MCP endpoint.
func (Request) IsNotification ¶
IsNotification reports whether the request is a JSON-RPC 2.0 notification: a request with no "id" member. Notifications MUST NOT receive a response.
type Response ¶
type Response struct {
JSONRPC string `json:"jsonrpc"`
ID json.RawMessage `json:"id"`
Result any `json:"result,omitempty"`
Error *Error `json:"error,omitempty"`
}
Response is the JSON-RPC 2.0 envelope returned by the MCP endpoint.
func ErrorResponse ¶
func ErrorResponse(id json.RawMessage, err *Error) Response
ErrorResponse builds a JSON-RPC error envelope.
func Handle ¶
func Handle(r io.Reader, d Dispatcher) (Response, bool)
Handle decodes one JSON-RPC request from r and dispatches it. The returned bool reports whether a response should be written back to the client: JSON-RPC notifications (requests without an "id") MUST NOT receive a response, so callers must suppress the response body when it is false.
func SuccessResponse ¶
func SuccessResponse(id json.RawMessage, result any) Response
SuccessResponse builds a JSON-RPC success envelope.
type ServerInfo ¶
ServerInfo identifies this MCP server surface.
type Tool ¶
type Tool struct {
Name string `json:"name"`
Description string `json:"description"`
InputSchema any `json:"inputSchema"`
}
Tool is an MCP tool descriptor.
type ToolCallParams ¶
type ToolCallParams struct {
Name string `json:"name"`
Arguments json.RawMessage `json:"arguments,omitempty"`
}
ToolCallParams is the tools/call params payload.
type ToolCallResult ¶
type ToolCallResult struct {
Content []ToolContent `json:"content"`
StructuredContent any `json:"structuredContent,omitempty"`
}
ToolCallResult is the MCP tools/call result payload.
func NewToolCallResult ¶
func NewToolCallResult(payload any) (ToolCallResult, error)
NewToolCallResult returns both structured JSON and a text JSON representation for MCP clients that only consume content[].
type ToolContent ¶
ToolContent is one MCP content item.
type ToolHandler ¶
type ToolHandler func(name string, arguments json.RawMessage) (any, *Error)
ToolHandler executes one named MCP tool and returns the structured payload for the MCP tools/call result.