jsonrpc

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 22, 2025 License: MIT Imports: 1 Imported by: 1

Documentation

Overview

Package jsonrpc exposes part of a JSON-RPC v2 implementation for use by mcp transport authors.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EncodeMessage added in v0.3.0

func EncodeMessage(msg Message) ([]byte, error)

EncodeMessage serializes a JSON-RPC message to its wire format.

Types

type ID

type ID = jsonrpc2.ID

ID is a JSON-RPC request ID.

func MakeID added in v0.3.0

func MakeID(v any) (ID, error)

MakeID coerces the given Go value to an ID. The value is assumed to be the default JSON marshaling of a Request identifier -- nil, float64, or string.

Returns an error if the value type was not a valid Request ID type.

type Message

type Message = jsonrpc2.Message

Message is a JSON-RPC message.

func DecodeMessage added in v0.3.0

func DecodeMessage(data []byte) (Message, error)

DecodeMessage deserializes JSON-RPC wire format data into a Message. It returns either a Request or Response based on the message content.

type Request

type Request = jsonrpc2.Request

Request is a JSON-RPC request.

type Response

type Response = jsonrpc2.Response

Response is a JSON-RPC response.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL