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

Function callCommandRpc

test/integration/smoke-daemon-http.test.ts:69–93  ·  view source on GitHub ↗
(
  info: DaemonInfo,
  command: string,
)

Source from the content-addressed store, hash-verified

67}
68
69async function callCommandRpc(
70 info: DaemonInfo,
71 command: string,
72): Promise<{ status: number; body: any }> {
73 const response = await fetch(`http://127.0.0.1:${info.httpPort}/rpc`, {
74 method: 'POST',
75 headers: { 'content-type': 'application/json' },
76 body: JSON.stringify({
77 jsonrpc: '2.0',
78 id: `rpc-${Date.now()}`,
79 method: 'agent_device.command',
80 params: {
81 token: info.token,
82 session: 'default',
83 command,
84 positionals: [],
85 flags: {},
86 },
87 }),
88 });
89 return {
90 status: response.status,
91 body: await response.json(),
92 };
93}
94
95async function stopDaemonForStateDir(stateDir: string): Promise<void> {
96 try {

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected