get_workflow
Retrieve a specific workflow by its unique ID using this tool, enabling efficient access to structured, multi-step task paths for precise execution and management.
Instructions
Get a specific workflow by ID
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes |
Implementation Reference
- src/index.ts:391-410 (handler)The main handler function that executes the 'get_workflow' tool logic. It validates input using GetWorkflowSchema, retrieves the workflow from storage using this.storage.get(), handles not found errors, and returns the workflow as JSON in the MCP response format.private async getWorkflow(args: unknown) { const parsed = GetWorkflowSchema.parse(args); const workflow = await this.storage.get(parsed.id); if (!workflow) { throw new Error(`Workflow not found: ${parsed.id}`); } return { content: [ { type: 'text', text: JSON.stringify({ success: true, workflow, }, null, 2), }, ], }; }
- src/index.ts:51-53 (schema)Zod schema for validating input to the get_workflow tool, requiring a single 'id' string parameter.const GetWorkflowSchema = z.object({ id: z.string(), });
- src/index.ts:263-266 (registration)Registration of the 'get_workflow' tool in the MCP tools list returned by listTools, including name, description, and input schema.name: 'get_workflow', description: 'Get a specific workflow by ID', inputSchema: zodToJsonSchema(GetWorkflowSchema), },
- src/services/storage.ts:68-79 (helper)Core storage helper method called by the handler to retrieve the workflow JSON file from disk and parse it.async get(id: string): Promise<Workflow | null> { try { const filePath = this.getWorkflowPath(id); const data = await fs.readFile(filePath, 'utf-8'); return JSON.parse(data) as Workflow; } catch (error) { if ((error as any).code === 'ENOENT') { return null; } throw error; } }
- src/services/storage.ts:36-37 (helper)Helper method to construct the file path for a workflow by ID, used in storage.get().private getWorkflowPath(id: string): string { return path.join(this.workflowsDir, `${id}.json`);