-32603 http/jsonrpc.ts
JSON-RPC 2.0 envelope schemas for RPC dispatch and SAES transport.
Params are object-only following MCP (no positional arrays); per-action
spec.input narrows further. Result is the full JSON-RPC valid value
space per spec ยง5 ("determined by the method invoked"): object, array,
string, number, boolean, or null โ the per-action spec.output is the
actual contract. The envelope-level loose-object-only constraint
inherited from MCP would reject any action with output: z.null() /
z.string() / etc. on the wire, so we relax it here while keeping
MCP-superset shape on params + _meta.
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
JSONRPC_INTERNAL_ERROR #
JSONRPC_INVALID_PARAMS #
-32602 JSONRPC_INVALID_REQUEST #
-32600 JSONRPC_METHOD_NOT_FOUND #
-32601 JSONRPC_PARSE_ERROR #
-32700 JSONRPC_SERVER_ERROR_END #
-32099 End of the server-defined error code range (-32099).
JSONRPC_SERVER_ERROR_START #
-32000 Start of the server-defined error code range (-32000).
JSONRPC_VERSION #
"2.0" JsonrpcErrorCode #
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 #
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 #
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 #
ZodObject<{}, $loose> MCP metadata object โ loose to allow additional properties and .extend.
JsonrpcMessage #
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 #
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 #
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 #
ZodString A JSON-RPC method name.
JsonrpcNotification #
ZodObject<{ jsonrpc: ZodLiteral<"2.0">; method: ZodString; params: ZodOptional<ZodObject<{}, $loose>>; }, $loose> A notification which does not expect a response.
JsonrpcNotificationParams #
ZodObject<{}, $loose> Notification params โ loose object. Per-action schemas validate _meta content.
JsonrpcProgressToken #
ZodUnion<readonly [ZodString, ZodNumber]> A progress token, used to associate progress notifications with the original request.
JsonrpcRequest #
ZodObject<{ jsonrpc: ZodLiteral<"2.0">; id: ZodUnion<readonly [ZodString, ZodNumber]>; method: ZodString; params: ZodOptional<ZodObject<{}, $loose>>; }, $loose> A request that expects a response.
JsonrpcRequestId #
ZodUnion<readonly [ZodString, ZodNumber]> A uniquely identifying id for a request in JSON-RPC. Like MCP, excludes null.
JsonrpcRequestParams #
ZodObject<{}, $loose> Request params โ loose object. Per-action schemas validate _meta content.
JsonrpcRequestParamsMeta #
ZodObject<{ progressToken: ZodOptional<ZodUnion<readonly [ZodString, ZodNumber]>>; }, $loose> Request params metadata โ extends MCP meta with optional progress token.
JsonrpcResponse #
ZodObject<{ jsonrpc: ZodLiteral<"2.0">; id: ZodUnion<readonly [ZodString, ZodNumber]>; result: ZodJSONSchema; }, $loose> A successful (non-error) response to a request.
JsonrpcResponseOrError #
ZodUnion<readonly [ZodObject<{ jsonrpc: ZodLiteral<"2.0">; id: ZodUnion<readonly [ZodString, ZodNumber]>; result: ZodJSONSchema; }, $loose>, ZodObject<...>]> A successful response or an error response.
JsonrpcResult #
ZodJSONSchema Result โ any JSON value per JSON-RPC 2.0 ยง5. Per-action spec.output
is the actual contract; the envelope only asserts presence + JSON-ness.
z.json() is required (not implicitly optional like z.unknown() /
z.any(), which would let an error envelope {jsonrpc, id, error}
parse successfully against the success envelope and break union
discrimination).
JsonrpcServerErrorCode #
$ZodBranded<ZodNumber, "JsonrpcServerErrorCode", "out"> A server-defined error code in the -32000 to -32099 range.