( tool: ToolDefinition, catalog: ToolCatalog, )
| 45 | } |
| 46 | |
| 47 | function buildTemplateNextSteps( |
| 48 | tool: ToolDefinition, |
| 49 | catalog: ToolCatalog, |
| 50 | ): BuiltTemplateNextStep[] { |
| 51 | if (!tool.nextStepTemplates || tool.nextStepTemplates.length === 0) { |
| 52 | return []; |
| 53 | } |
| 54 | |
| 55 | const built: BuiltTemplateNextStep[] = []; |
| 56 | for (const template of tool.nextStepTemplates) { |
| 57 | if (!template.toolId) { |
| 58 | built.push({ |
| 59 | step: { |
| 60 | label: template.label, |
| 61 | priority: template.priority, |
| 62 | when: template.when, |
| 63 | }, |
| 64 | }); |
| 65 | continue; |
| 66 | } |
| 67 | |
| 68 | const target = catalog.getByToolId(template.toolId); |
| 69 | if (!target) { |
| 70 | continue; |
| 71 | } |
| 72 | |
| 73 | built.push({ |
| 74 | step: { |
| 75 | tool: target.mcpName, |
| 76 | label: template.label, |
| 77 | params: template.params ?? {}, |
| 78 | priority: template.priority, |
| 79 | when: template.when, |
| 80 | }, |
| 81 | templateToolId: template.toolId, |
| 82 | }); |
| 83 | } |
| 84 | |
| 85 | return built; |
| 86 | } |
| 87 | |
| 88 | function consumeDynamicParams( |
| 89 | nextStepParams: NextStepParamsMap | undefined, |
no test coverage detected