GitHub

McpError

API reference for McpError.

A JSON-RPC error a request fails with: its code and message.

Attributes

AttributeTypeDescription
CODEint = INTERNAL_ERROR_CODE
messagestr
dataJsonValue = None
codeint

Functions

__init__

__init__(message, data=None) -> None
ParameterTypeDescription
messagestr
dataJsonValue = None

to_wire

to_wire() -> JsonRpcErrorObject

Returns JsonRpcErrorObject

def to_wire(self) -> JsonRpcErrorObject:
    error: JsonRpcErrorObject = {"code": self.code, "message": self.message}
    if self.data is not None:
        error["data"] = self.data
    return error