Skip to main content

rpc

Define and serve RPC methods from a MOD service. Other MODs, the engine, and AI agents can call these methods through the engine's RPC proxy.

note

This module uses Node.js APIs (node:http, process) and is not browser-compatible. It is intentionally not re-exported from the main @hmcs/sdk entry point.

Import​

import { rpc } from "@hmcs/sdk/rpc";

Functions​

FunctionDescription
serveStart the RPC server and register methods with the engine
methodDefine an RPC method with optional Zod validation
callCall an RPC method on another MOD's service

Type Definitions​

TypeDescription
RpcServerServer instance returned by serve()
RpcMethodEntryMethod definition used in serve({ methods })
RpcCallOptionsOptions for call()