mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-09 00:01:17 +00:00
21 lines
674 B
TypeScript
21 lines
674 B
TypeScript
export const MCP_LOOPBACK_SERVER_NAME = "openclaw";
|
|
export const MCP_LOOPBACK_SERVER_VERSION = "0.1.0";
|
|
export const MCP_LOOPBACK_SUPPORTED_PROTOCOL_VERSIONS = ["2025-03-26", "2024-11-05"] as const;
|
|
|
|
export type JsonRpcId = string | number | null | undefined;
|
|
|
|
export type JsonRpcRequest = {
|
|
jsonrpc: "2.0";
|
|
id?: JsonRpcId;
|
|
method: string;
|
|
params?: Record<string, unknown>;
|
|
};
|
|
|
|
export function jsonRpcResult(id: JsonRpcId, result: unknown) {
|
|
return { jsonrpc: "2.0" as const, id: id ?? null, result };
|
|
}
|
|
|
|
export function jsonRpcError(id: JsonRpcId, code: number, message: string) {
|
|
return { jsonrpc: "2.0" as const, id: id ?? null, error: { code, message } };
|
|
}
|