()
| 34 | }; |
| 35 | |
| 36 | export 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 | |
| 60 | export function createCommandToolExecutor(deps: CommandToolExecutorDeps = {}): CommandToolExecutor { |
| 61 | return { |
no test coverage detected