Documentation
¶
Index ¶
Constants ¶
View Source
const ( CodeParseError = -32700 CodeInvalidRequest = -32600 CodeMethodNotFound = -32601 CodeInvalidParams = -32602 CodeInternalError = -32603 CodeAuthFailed = -32000 )
Error codes as defined by JSON-RPC 2.0 and MCP extensions.
View Source
const Version = "2.0"
Version is the JSON-RPC 2.0 version string.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Error ¶
type Error struct {
Code int `json:"code"`
Message string `json:"message"`
Data json.RawMessage `json:"data,omitempty"`
}
Error represents a JSON-RPC 2.0 error object.
type ID ¶
type ID struct {
// contains filtered or unexported fields
}
ID represents a JSON-RPC request ID, which can be a string, number, or null.
func (*ID) MarshalJSON ¶
MarshalJSON implements json.Marshaler.
func (*ID) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler.
type Message ¶
Message is a parsed JSON-RPC frame. Exactly one of Request or Resp will be set when IsJSON is true.
type ParseMode ¶
type ParseMode int
ParseMode controls how the parser splits the byte stream into messages.
type Parser ¶
type Parser struct {
// contains filtered or unexported fields
}
Parser reads JSON-RPC messages from a stream.
type Request ¶
type Request struct {
JSONRPC string `json:"jsonrpc"`
ID *ID `json:"id,omitempty"`
Method string `json:"method"`
Params json.RawMessage `json:"params,omitempty"`
}
Request represents a JSON-RPC 2.0 request or notification.
func (*Request) IsNotification ¶
IsNotification returns true if the request has no ID (i.e., it is a notification).
Click to show internal directories.
Click to hide internal directories.