Class JsonRpcMessage
- Namespace
- ModelContextProtocol.Protocol
- Assembly
- ModelContextProtocol.Core.dll
Represents any JSON-RPC message used in the Model Context Protocol (MCP).
[JsonConverter(typeof(JsonRpcMessage.Converter))]
public abstract class JsonRpcMessage
- Inheritance
-
JsonRpcMessage
- Derived
- Inherited Members
Remarks
This interface serves as the foundation for all message types in the JSON-RPC 2.0 protocol used by MCP, including requests, responses, notifications, and errors. JSON-RPC is a stateless, lightweight remote procedure call (RPC) protocol that uses JSON as its data format.
Properties
Context
Gets or sets the contextual information for this JSON-RPC message.
[JsonIgnore]
public JsonRpcMessageContext? Context { get; set; }
Property Value
Remarks
This property contains transport-specific and runtime context information that accompanies JSON-RPC messages but is not serialized as part of the JSON-RPC payload. This includes transport references, execution context, and authenticated user information.
JsonRpc
Gets the JSON-RPC protocol version used.
[JsonPropertyName("jsonrpc")]
public string JsonRpc { get; init; }