list_workflows
Retrieve and organize workflows with customizable filters and sorting options, enabling efficient management and access to task execution records within the MCP server.
Instructions
List all workflows with optional filtering and sorting
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| filter | No | ||
| sort | No |
Implementation Reference
- src/index.ts:358-389 (handler)The handler function for the list_workflows tool. It parses the input arguments using the schema, retrieves workflows from storage with optional filtering and sorting, creates summaries of each workflow, and returns a JSON-formatted response with the list.private async listWorkflows(args: unknown) { const parsed = ListWorkflowsSchema.parse(args); const workflows = await this.storage.list(parsed.filter, parsed.sort); // Create summary for each workflow const summaries = workflows.map(w => ({ id: w.id, name: w.name, description: w.description, version: w.version, tags: w.tags, steps_count: w.steps.length, created_at: w.metadata?.created_at, times_run: w.metadata?.times_run || 0, success_rate: w.metadata?.success_rate, is_deleted: w.is_deleted, })); return { content: [ { type: 'text', text: JSON.stringify({ success: true, count: summaries.length, workflows: summaries, }, null, 2), }, ], }; }
- src/index.ts:36-49 (schema)Zod schema defining the input structure for the list_workflows tool, including optional filter criteria (tags, name_contains, dates, success_rate, deleted status) and optional sorting by field and order.const ListWorkflowsSchema = z.object({ filter: z.object({ tags: z.array(z.string()).optional(), name_contains: z.string().optional(), created_after: z.string().optional(), created_before: z.string().optional(), min_success_rate: z.number().optional(), is_deleted: z.boolean().optional(), }).optional(), sort: z.object({ field: z.enum(['name', 'created_at', 'updated_at', 'times_run', 'success_rate']), order: z.enum(['asc', 'desc']), }).optional(), });
- src/index.ts:257-261 (registration)Registration of the list_workflows tool in the getTools() method, specifying the tool name, description, and converting the Zod schema to JSON schema for MCP protocol compliance.{ name: 'list_workflows', description: 'List all workflows with optional filtering and sorting', inputSchema: zodToJsonSchema(ListWorkflowsSchema), },