Documentation
¶
Overview ¶
Package protocol implements bounded MCP 2026-07-28 wire types.
Index ¶
- Constants
- func Decode(raw []byte) (Inbound, *DecodeError)
- func DecodeLegacyInitialize(params map[string]any) (RequestMeta, *RPCError)
- func DecodeLegacyRequestMeta(params map[string]any) (RequestMeta, *RPCError)
- func DecodeRequestMeta(params map[string]any) (RequestMeta, *RPCError)
- func ExtractVersionArgument(arguments []string) ([]string, string, bool)
- type DecodeError
- type ID
- type Inbound
- type RPCError
- type Request
- type RequestMeta
Constants ¶
View Source
const ( Version = "2026-07-28" JSONRPCVersion = "2.0" MaxMessageBytes = 1 << 20 MaxJSONDepth = 64 // Reflectable request scalars are smaller than a frame so every error // response remains independently bounded. MaxRequestIDBytes = 128 MaxProtocolVersionBytes = 64 CodeParseError = -32700 CodeInvalidRequest = -32600 CodeMethodNotFound = -32601 CodeInvalidParams = -32602 CodeInternalError = -32603 CodeUnsupportedProtocolVersion = -32022 )
View Source
const LegacyVersion = "2025-11-25"
Variables ¶
This section is empty.
Functions ¶
func Decode ¶
func Decode(raw []byte) (Inbound, *DecodeError)
Decode accepts one newline-free stdio message body. Syntax, UTF-8, duplicate-key, size, and depth failures intentionally discard any ID.
func DecodeLegacyInitialize ¶
func DecodeLegacyInitialize(params map[string]any) (RequestMeta, *RPCError)
func DecodeLegacyRequestMeta ¶
func DecodeLegacyRequestMeta(params map[string]any) (RequestMeta, *RPCError)
Legacy requests carry optional progress metadata; modern transport metadata must never change the connection's explicitly selected protocol.
func DecodeRequestMeta ¶
func DecodeRequestMeta(params map[string]any) (RequestMeta, *RPCError)
Types ¶
type DecodeError ¶
func (*DecodeError) Error ¶
func (e *DecodeError) Error() string
type ID ¶
type ID struct {
// contains filtered or unexported fields
}
ID preserves the type and exact integer spelling of a JSON-RPC request ID.
func NewIntegerID ¶
func NewStringID ¶
func ParseIDValue ¶
ParseIDValue validates a decoded JSON value as a protocol request ID.
func (ID) MarshalJSON ¶
type RPCError ¶
func DecodeCursor ¶
DecodeCursor returns the optional cursor on current list requests.
func InvalidParams ¶
func MethodNotFound ¶
func MethodNotFound() *RPCError
Click to show internal directories.
Click to hide internal directories.