* Determine if a tool is canonical in a given workflow. * A tool is canonical if its module path matches the workflow ID.
(tool: ToolManifestEntry, workflowId: string)
| 140 | * A tool is canonical if its module path matches the workflow ID. |
| 141 | */ |
| 142 | function isToolCanonicalInWorkflow(tool: ToolManifestEntry, workflowId: string): boolean { |
| 143 | // Check if the module path contains the workflow ID |
| 144 | // e.g., "mcp/tools/simulator/build_sim" is canonical for "simulator" |
| 145 | const moduleParts = tool.module.split('/'); |
| 146 | const workflowPart = moduleParts[2]; // mcp/tools/<workflow>/<tool> |
| 147 | return workflowPart === workflowId; |
| 148 | } |
| 149 | |
| 150 | /** |
| 151 | * Get the canonical workflow for a tool based on its module path. |