Skip to main content
Glama

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
NameRequiredDescriptionDefault
folderIdNoFilter by folder ID
activeOnlyNoShow only active flows
limitNoMaximum number of flows to return
offsetNoNumber 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) } ] }; } }
  • 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 };
  • 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);
  • Includes listFlowsTool in the flowTools array, which is exported and used in ALL_TOOLS in src/tools/index.ts
    export const flowTools = [ executeFlowTool, createFlowTool, getFlowDetailsTool, listFlowsTool, deleteFlowTool
  • Re-exports listFlowsTool from tools.ts for use in parent modules.
    export { flowTools, executeFlowTool, createFlowTool, getFlowDetailsTool, listFlowsTool, deleteFlowTool } from './tools.js';

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/martin-1103/mcp2'

If you have feedback or need assistance with the MCP directory API, please join our Discord server