INNER CODE UNIT · TypeScript
tool
gensx-inc/gensx · packages/gensx-cloud-mcp/src/index.ts:309
const tool = validTools.find((t) => t.name === workflowName);
if (!tool) {
throw new Error(`Unknown workflow: ${workflowName}`);
}
// Ensure args is not undefined and is an object
const args = toolArgs ?? {};
// Validate input using our simple validator
if (!tool.validator(args)) {
throw new Error(
`Invalid arguments for workflow ${workflowName}: missing required fields`,
);
}
// Run the workflow
debugLog(`Running workflow ${workflowName} with args:`, args);
const result = await client.runWorkflow(workflowName, args);