Skip to main content

Type Definitions

RpcMethodDef<I, O>​

A typed RPC method definition created by rpc.method().

FieldTypeRequiredDescription
descriptionstringNoHuman-readable description
timeoutnumberNoTimeout in milliseconds
inputZodType<I>NoZod schema for input validation
handler(params: I) => Promise<O>YesRequest handler

RpcHandlerFn<O>​

(params: unknown) => Promise<O>

A plain async function that can be used as an RPC method handler. The raw parsed JSON body is passed directly without validation.

RpcMethodEntry​

RpcMethodDef | RpcHandlerFn

Union type accepted by rpc.serve(). You can mix rpc.method() definitions and plain functions in the same methods map.

RpcServeOptions​

FieldTypeDescription
methodsRecord<string, RpcMethodEntry>Method name → definition map

RpcServer​

The return value of rpc.serve().

FieldTypeDescription
portnumberPort the server is listening on
close() => Promise<void>Gracefully shuts down the server

RpcCallOptions​

Options for rpc.call().

FieldTypeRequiredDescription
modNamestringYesName of the target MOD
methodstringYesRPC method name to invoke
bodyunknownNoOptional request body passed to the method handler