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

Function execute

src/client/client.ts:67–86  ·  view source on GitHub ↗
(
    command: string,
    positionals: string[] = [],
    options: InternalRequestOptions = {},
    metadataFlags?: Partial<CommandFlags>,
  )

Source from the content-addressed store, hash-verified

65 isNonDefaultResponseLevel(options.responseLevel ?? config.responseLevel);
66
67 const execute = async (
68 command: string,
69 positionals: string[] = [],
70 options: InternalRequestOptions = {},
71 metadataFlags?: Partial<CommandFlags>,
72 ): Promise<Record<string, unknown>> => {
73 const merged = mergeClientOptions(config, options);
74 const response = await transport({
75 session: resolveSessionName(merged.session),
76 command,
77 positionals,
78 flags: buildRequestFlags(merged, metadataFlags),
79 runtime: merged.runtime,
80 meta: buildMeta(merged),
81 });
82 if (!response.ok) {
83 throwDaemonError(response.error);
84 }
85 return (response.data ?? {}) as Record<string, unknown>;
86 };
87
88 const listSessions = async (options = {}) => {
89 const data = await execute(INTERNAL_COMMANDS.sessionList, [], options);

Callers 3

listSessionsFunction · 0.70
executeCommandFunction · 0.70
createAgentDeviceClientFunction · 0.70

Calls 6

resolveSessionNameFunction · 0.90
buildRequestFlagsFunction · 0.90
buildMetaFunction · 0.90
throwDaemonErrorFunction · 0.90
mergeClientOptionsFunction · 0.85
transportFunction · 0.85

Tested by

no test coverage detected