JSONRPCRequest

data class JSONRPCRequest @JvmOverloads constructor(val id: RequestId = RequestId(Uuid.random().toHexString()), val method: String, val params: JsonElement? = null) : JSONRPCMessage(source)

A request that expects a response.

Requests are identified by a unique id and specify a method to invoke. The server or client (depending on a direction) must respond with either a JSONRPCResponse or JSONRPCError that has the same id.

Constructors

Link copied to clipboard
constructor(id: RequestId = RequestId(Uuid.random().toHexString()), method: String, params: JsonElement? = null)
constructor(id: String, method: String, params: JsonElement? = null)

Secondary constructor for creating a JSONRPCRequest using a string-based ID.

constructor(id: Long, method: String, params: JsonElement? = null)

Constructs a JSON-RPC request using a numerical ID, method name, and optional parameters.

Properties

Link copied to clipboard

A unique identifier for this request. The response will include the same ID. Can be a string or number. UUID string is used by default.

Link copied to clipboard
open override val jsonrpc: String

Always "2.0" to indicate JSON-RPC 2.0 protocol.

Link copied to clipboard

The name of the method to invoke (e.g., "tools/list", "resources/read").

Link copied to clipboard

Optional parameters for the method. Structure depends on the specific method.

Functions

Link copied to clipboard

Decodes a JSON-RPC request into a protocol-specific Request.