http/jsonrpc.ts

JSON-RPC 2.0 envelope schemas for RPC dispatch and SAES transport.

Following MCP, params and result are object-only (no positional arrays). MCP _meta types (JsonrpcMcpMeta, JsonrpcRequestParamsMeta) are exported as building blocks for per-action schemas but are NOT validated at the envelope level — _meta content validation belongs in per-action schemas where it produces the correct error code (invalid_params, not invalid_request).

@source https://github.com/modelcontextprotocol/typescript-sdk @see https://www.jsonrpc.org/specification

Declarations
#

27 declarations

view source

JSONRPC_INTERNAL_ERROR
#

JSONRPC_INVALID_PARAMS
#

JSONRPC_INVALID_REQUEST
#

JSONRPC_METHOD_NOT_FOUND
#

JSONRPC_PARSE_ERROR
#

JSONRPC_SERVER_ERROR_END
#

JSONRPC_SERVER_ERROR_START
#

JSONRPC_VERSION
#

JsonrpcErrorCode
#

http/jsonrpc.ts view source

ZodUnion<readonly [ZodLiteral<-32700>, ZodLiteral<-32600>, ZodLiteral<-32601>, ZodLiteral<-32602>, ZodLiteral<-32603>, $ZodBranded<...>]>

A valid JSON-RPC error code — one of the 5 standard codes or a server-defined code in the -32000 to -32099 range.

JsonrpcErrorObject
#

http/jsonrpc.ts view source

ZodObject<{ code: ZodUnion<readonly [ZodLiteral<-32700>, ZodLiteral<-32600>, ZodLiteral<-32601>, ZodLiteral<-32602>, ZodLiteral<-32603>, $ZodBranded<...>]>; message: ZodString; data: ZodOptional<...>; }, $loose>

Error object within a JSON-RPC error response.

JsonrpcErrorResponse
#

http/jsonrpc.ts view source

ZodObject<{ jsonrpc: ZodLiteral<"2.0">; id: ZodNullable<ZodUnion<readonly [ZodString, ZodNumber]>>; error: ZodObject<{ code: ZodUnion<readonly [ZodLiteral<-32700>, ... 4 more ..., $ZodBranded<...>]>; message: ZodString; data: ZodOptional<...>; }, $loose>; }, $loose>

A response that indicates an error occurred.

JsonrpcMcpMeta
#

JsonrpcMessage
#

http/jsonrpc.ts view source

ZodUnion<readonly [ZodObject<{ jsonrpc: ZodLiteral<"2.0">; id: ZodUnion<readonly [ZodString, ZodNumber]>; method: ZodString; params: ZodOptional<ZodObject<{}, $loose>>; }, $loose>, ZodObject<...>, ZodObject<...>, ZodObject<...>]>

Any valid JSON-RPC message (request, notification, response, or error response).

JsonrpcMessageFromClientToServer
#

http/jsonrpc.ts view source

ZodUnion<readonly [ZodObject<{ jsonrpc: ZodLiteral<"2.0">; id: ZodUnion<readonly [ZodString, ZodNumber]>; method: ZodString; params: ZodOptional<ZodObject<{}, $loose>>; }, $loose>, ZodObject<...>]>

Messages a client can send to a server (request or notification).

JsonrpcMessageFromServerToClient
#

http/jsonrpc.ts view source

ZodUnion<readonly [ZodObject<{ jsonrpc: ZodLiteral<"2.0">; method: ZodString; params: ZodOptional<ZodObject<{}, $loose>>; }, $loose>, ZodObject<...>, ZodObject<...>]>

Messages a server can send to a client (notification, response, or error response).

JsonrpcMethod
#

JsonrpcNotification
#

http/jsonrpc.ts view source

ZodObject<{ jsonrpc: ZodLiteral<"2.0">; method: ZodString; params: ZodOptional<ZodObject<{}, $loose>>; }, $loose>

A notification which does not expect a response.

JsonrpcNotificationParams
#

http/jsonrpc.ts view source

ZodObject<{}, $loose>

Notification params — loose object. Per-action schemas validate _meta content.

JsonrpcProgressToken
#

http/jsonrpc.ts view source

ZodUnion<readonly [ZodString, ZodNumber]>

A progress token, used to associate progress notifications with the original request.

JsonrpcRequest
#

http/jsonrpc.ts view source

ZodObject<{ jsonrpc: ZodLiteral<"2.0">; id: ZodUnion<readonly [ZodString, ZodNumber]>; method: ZodString; params: ZodOptional<ZodObject<{}, $loose>>; }, $loose>

A request that expects a response.

JsonrpcRequestId
#

http/jsonrpc.ts view source

ZodUnion<readonly [ZodString, ZodNumber]>

A uniquely identifying id for a request in JSON-RPC. Like MCP, excludes null.

JsonrpcRequestParams
#

JsonrpcRequestParamsMeta
#

http/jsonrpc.ts view source

ZodObject<{ progressToken: ZodOptional<ZodUnion<readonly [ZodString, ZodNumber]>>; }, $loose>

Request params metadata — extends MCP meta with optional progress token.

JsonrpcResponse
#

http/jsonrpc.ts view source

ZodObject<{ jsonrpc: ZodLiteral<"2.0">; id: ZodUnion<readonly [ZodString, ZodNumber]>; result: ZodObject<{}, $loose>; }, $loose>

A successful (non-error) response to a request.

JsonrpcResponseOrError
#

http/jsonrpc.ts view source

ZodUnion<readonly [ZodObject<{ jsonrpc: ZodLiteral<"2.0">; id: ZodUnion<readonly [ZodString, ZodNumber]>; result: ZodObject<{}, $loose>; }, $loose>, ZodObject<...>]>

A successful response or an error response.

JsonrpcResult
#

JsonrpcServerErrorCode
#

http/jsonrpc.ts view source

$ZodBranded<ZodNumber, "JsonrpcServerErrorCode", "out">

A server-defined error code in the -32000 to -32099 range.

Imported by
#