n8n_list_workflows
Retrieve workflows from a live n8n instance with optional filters for active status, tags, or name. Returns IDs, names, node counts, tags, and last update time.
Instructions
List workflows from a live n8n instance (requires N8N_API_URL + N8N_API_KEY env vars). Returns id, name, active, nodeCount, updatedAt, tags. Filter by active, tags, name. Use this when the user asks 'what workflows do I have?' or before n8n_get_workflow.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| active | No | Filter by active status. Omit to return both. | |
| tags | No | Comma-separated tag names to filter by. | |
| name | No | Filter by exact workflow name. | |
| limit | No | Page size (n8n default: 100, max: 250). |
Implementation Reference
- src/tools/rest-api.ts:115-140 (handler)The async function `listWorkflows` that executes the tool logic. Parses arguments with Zod, builds query params (active/tags/name/limit), makes a GET /workflows call to the n8n API, and returns a summarized JSON result with id, name, active, nodeCount, updatedAt, and tags.
export async function listWorkflows(rawArgs: unknown) { const cfg = getConfig(); if ("error" in cfg) return textResult(cfg.error); const args = listWorkflowsZod.parse(rawArgs ?? {}); const params = new URLSearchParams(); if (args.active !== undefined) params.set("active", String(args.active)); if (args.tags) params.set("tags", args.tags); if (args.name) params.set("name", args.name); if (args.limit) params.set("limit", String(args.limit)); const qs = params.toString() ? `?${params}` : ""; const r = await call(cfg, "GET", `/workflows${qs}`); if (!r.ok) return textResult(r.error); const data = r.data as { data?: unknown[] } | unknown[]; const arr = Array.isArray(data) ? data : data?.data ?? []; const summary = (arr as Array<Record<string, unknown>>).map((w) => ({ id: w.id, name: w.name, active: w.active, nodeCount: Array.isArray(w.nodes) ? (w.nodes as unknown[]).length : undefined, updatedAt: w.updatedAt, tags: Array.isArray(w.tags) ? (w.tags as Array<{ name?: string }>).map((t) => t.name).filter(Boolean) : undefined, })); return jsonResult(summary); } - src/tools/rest-api.ts:86-106 (schema)The `listWorkflowsInputSchema` JSON schema defining input properties (active, tags, name, limit) for the n8n_list_workflows tool.
export const listWorkflowsInputSchema = { type: "object", properties: { active: { type: "boolean", description: "Filter by active status. Omit to return both.", }, tags: { type: "string", description: "Comma-separated tag names to filter by.", }, name: { type: "string", description: "Filter by exact workflow name.", }, limit: { type: "number", description: "Page size (n8n default: 100, max: 250).", }, }, } as const; - src/tools/rest-api.ts:108-113 (schema)The `listWorkflowsZod` Zod schema used inside the handler for runtime validation and parsing of the tool's arguments.
const listWorkflowsZod = z.object({ active: z.boolean().optional(), tags: z.string().optional(), name: z.string().optional(), limit: z.number().int().positive().max(250).optional(), }); - src/index.ts:64-69 (registration)The tool registration object in the tools array: defines name 'n8n_list_workflows', description, and inputSchema reference.
{ name: "n8n_list_workflows", description: "List workflows from a live n8n instance (requires N8N_API_URL + N8N_API_KEY env vars). Returns id, name, active, nodeCount, updatedAt, tags. Filter by active, tags, name. Use this when the user asks 'what workflows do I have?' or before n8n_get_workflow.", inputSchema: listWorkflowsInputSchema, }, - src/index.ts:119-120 (registration)The switch-case handler in CallToolRequestSchema that routes 'n8n_list_workflows' to the listWorkflows function.
case "n8n_list_workflows": return listWorkflows(args ?? {});