protocol
protocol
¶
MCP JSON-RPC 2.0 protocol message types.
Classes¶
MCPRequest
dataclass
¶
JSON-RPC 2.0 request message.
Functions¶
to_json
¶
from_json
classmethod
¶
from_json(data: str) -> MCPRequest
Deserialize from JSON string.
Source code in src/openjarvis/mcp/protocol.py
MCPResponse
dataclass
¶
MCPResponse(result: Any = None, error: Optional[Dict[str, Any]] = None, id: int | str = 0, jsonrpc: str = '2.0')
JSON-RPC 2.0 response message.
Functions¶
to_json
¶
Serialize to JSON string.
from_json
classmethod
¶
from_json(data: str) -> MCPResponse
Deserialize from JSON string.
Source code in src/openjarvis/mcp/protocol.py
error_response
classmethod
¶
error_response(id: int | str, code: int, message: str, data: Any = None) -> MCPResponse
Create an error response.
Source code in src/openjarvis/mcp/protocol.py
MCPNotification
dataclass
¶
JSON-RPC 2.0 notification (no id, no response expected).
MCPError
dataclass
¶
Bases: Exception
MCP protocol error with JSON-RPC error code.