( toolId: string, blockType?: string, currentValues?: Record<string, unknown> )
| 253 | * Also includes UI component information from block configurations |
| 254 | */ |
| 255 | export function getToolParametersConfig( |
| 256 | toolId: string, |
| 257 | blockType?: string, |
| 258 | currentValues?: Record<string, unknown> |
| 259 | ): ToolWithParameters | null { |
| 260 | try { |
| 261 | const toolConfig = getTool(toolId) |
| 262 | if (!toolConfig) { |
| 263 | logger.warn(`Tool not found: ${toolId}`) |
| 264 | return null |
| 265 | } |
| 266 | |
| 267 | // Validate that toolConfig has required properties |
| 268 | if (!toolConfig.params || typeof toolConfig.params !== 'object') { |
| 269 | logger.warn(`Tool ${toolId} has invalid params configuration`) |
| 270 | return null |
| 271 | } |
| 272 | |
| 273 | // Special handling for workflow_executor tool |
| 274 | if (toolId === 'workflow_executor') { |
| 275 | const parameters: ToolParameterConfig[] = [ |
| 276 | { |
| 277 | id: 'workflowId', |
| 278 | type: 'string', |
| 279 | required: true, |
| 280 | visibility: 'user-only', |
| 281 | description: 'The ID of the workflow to execute', |
| 282 | uiComponent: { |
| 283 | type: 'workflow-selector', |
| 284 | placeholder: 'Select workflow to execute', |
| 285 | selectorKey: 'sim.workflows', |
| 286 | }, |
| 287 | }, |
| 288 | { |
| 289 | id: 'inputMapping', |
| 290 | type: 'object', |
| 291 | required: false, |
| 292 | visibility: 'user-or-llm', |
| 293 | description: 'Map inputs to the selected workflow', |
| 294 | uiComponent: { |
| 295 | type: 'workflow-input-mapper', |
| 296 | title: 'Workflow Inputs', |
| 297 | condition: { |
| 298 | field: 'workflowId', |
| 299 | value: '', |
| 300 | not: true, // Show when workflowId is not empty |
| 301 | }, |
| 302 | dependsOn: ['workflowId'], |
| 303 | }, |
| 304 | }, |
| 305 | ] |
| 306 | |
| 307 | return { |
| 308 | toolConfig, |
| 309 | allParameters: parameters, |
| 310 | userInputParameters: parameters.filter( |
| 311 | (param) => param.visibility === 'user-or-llm' || param.visibility === 'user-only' |
| 312 | ), |
no test coverage detected