MCPcopy Index your code
hub / github.com/callstack/agent-device / buildHttpRpcPayload

Function buildHttpRpcPayload

src/daemon/client/daemon-client-rpc.ts:96–120  ·  view source on GitHub ↗
(
  req: DaemonRequest,
  options: { includeTokenParam: boolean },
)

Source from the content-addressed store, hash-verified

94}
95
96export function buildHttpRpcPayload(
97 req: DaemonRequest,
98 options: { includeTokenParam: boolean },
99): {
100 jsonrpc: '2.0';
101 id: string;
102 method: string;
103 params: DaemonRequest | Record<string, unknown>;
104} {
105 const id = req.meta?.requestId ?? createRequestId();
106 if (!isLeaseRpcCommand(req.command)) {
107 return {
108 jsonrpc: '2.0',
109 id,
110 method: 'agent_device.command',
111 params: req,
112 };
113 }
114 return {
115 jsonrpc: '2.0',
116 id,
117 method: leaseRpcMethodForCommand(req.command),
118 params: buildLeaseRpcParams(req, req.command, options),
119 };
120}
121
122function isLeaseRpcCommand(command: string): command is LeaseRpcCommand {
123 return (

Callers 1

sendHttpRequestFunction · 0.90

Calls 4

createRequestIdFunction · 0.90
isLeaseRpcCommandFunction · 0.85
leaseRpcMethodForCommandFunction · 0.85
buildLeaseRpcParamsFunction · 0.85

Tested by

no test coverage detected