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

Function listCommandTools

src/mcp/command-tools.ts:36–58  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

34};
35
36export function listCommandTools(): Array<{
37 name: string;
38 description: string;
39 inputSchema: JsonSchema;
40 outputSchema?: JsonSchema;
41}> {
42 return listMcpCommandMetadata().map((definition) => {
43 // The registry is keyed by the typed-result commands only (CommandResultMap),
44 // so guard the lookup; untyped tools resolve to no outputSchema.
45 const outputSchema =
46 definition.name in COMMAND_OUTPUT_SCHEMAS
47 ? COMMAND_OUTPUT_SCHEMAS[definition.name as keyof typeof COMMAND_OUTPUT_SCHEMAS]
48 : undefined;
49 return {
50 name: definition.name,
51 description: definition.description,
52 inputSchema: withMcpConfigSchema(definition.inputSchema),
53 // Only typed commands carry an outputSchema; untyped tools stay
54 // byte-identical to today (no key at all), additive-only.
55 ...(outputSchema ? { outputSchema } : {}),
56 };
57 });
58}
59
60export function createCommandToolExecutor(deps: CommandToolExecutorDeps = {}): CommandToolExecutor {
61 return {

Callers 2

handleRequestFunction · 0.90

Calls 2

listMcpCommandMetadataFunction · 0.90
withMcpConfigSchemaFunction · 0.85

Tested by

no test coverage detected