list_flows
Retrieve and filter flows from your current project to manage API workflows, with options to show active flows only and control result pagination.
Instructions
List flows in the current project
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| folderId | No | Filter by folder ID | |
| activeOnly | No | Show only active flows | |
| limit | No | Maximum number of flows to return | |
| offset | No | Number of flows to skip |
Implementation Reference
- Main execution handler for list_flows tool. Retrieves project context, calls backend API to list flows with optional filters, formats results, and returns MCP response.export async function handleListFlows(args: any): Promise<McpToolResponse> { try { const { folderId, activeOnly, limit, offset } = args; const instances = await getInstances(); // Get project ID from config const config = await instances.configManager.detectProjectConfig(); const projectId = config?.project?.id; if (!projectId) { return { content: [ { type: 'text', text: JSON.stringify({ success: false, error: 'Project ID not found in config' }, null, 2) } ] }; } const projectResponse = await instances.backendClient.getProjectContext(projectId); if (!projectResponse.success || !projectResponse.data) { return { content: [ { type: 'text', text: JSON.stringify({ success: false, error: 'Failed to get current project' }, null, 2) } ] }; } // Get flows from API const flowsResponse = await instances.backendClient.getFlows({ project_id: projectId, folder_id: folderId, is_active: activeOnly, limit: limit || 50, offset: offset || 0 }); if (!flowsResponse.success) { return { content: [ { type: 'text', text: JSON.stringify({ success: false, error: flowsResponse.message || 'Failed to retrieve flows' }, null, 2) } ] }; } // Format flows for display const flows = (flowsResponse.data || []).map((flow: any) => ({ id: flow.id, name: flow.name, description: flow.description, folder_id: flow.folder_id, project_id: flow.project_id, is_active: flow.is_active, step_count: flow.flow_data?.steps?.length || 0, created_at: flow.created_at, updated_at: flow.updated_at })); return { content: [ { type: 'text', text: JSON.stringify({ success: true, data: flows, total: flows.length, message: `Retrieved ${flows.length} flows` }, null, 2) } ] }; } catch (error: any) { return { content: [ { type: 'text', text: JSON.stringify({ success: false, error: error.message || 'Unknown error occurred while listing flows' }, null, 2) } ] }; } }
- src/tools/flows/tools.ts:201-229 (schema)MCP tool definition including name, description, input schema (with optional filters: folderId, activeOnly, limit, offset), and handler reference.export const listFlowsTool: McpTool = { name: 'list_flows', description: 'List flows in the current project', inputSchema: { type: 'object', properties: { folderId: { type: 'string', description: 'Filter by folder ID' }, activeOnly: { type: 'boolean', description: 'Show only active flows', default: true }, limit: { type: 'number', description: 'Maximum number of flows to return', default: 50 }, offset: { type: 'number', description: 'Number of flows to skip', default: 0 } } }, handler: handleListFlows };
- src/tools/index.ts:180-182 (registration)Tool handler registration in the central factory function createFlowToolHandlers(), dynamically importing and delegating to the handleListFlows implementation.'list_flows': async (args: any) => { const { handleListFlows } = await import('./flows/handlers/detailsHandler.js'); return handleListFlows(args);
- src/tools/flows/tools.ts:253-258 (registration)Includes listFlowsTool in the flowTools array, which is exported and used in ALL_TOOLS in src/tools/index.tsexport const flowTools = [ executeFlowTool, createFlowTool, getFlowDetailsTool, listFlowsTool, deleteFlowTool
- src/tools/flows/index.ts:7-7 (registration)Re-exports listFlowsTool from tools.ts for use in parent modules.export { flowTools, executeFlowTool, createFlowTool, getFlowDetailsTool, listFlowsTool, deleteFlowTool } from './tools.js';