get-execution
Retrieve a specific workflow execution by ID using the n8n MCP Server, enabling secure access to execution details and data for integration with Large Language Models (LLMs).
Instructions
Retrieve a specific execution by ID.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| clientId | Yes | ||
| id | Yes | ||
| includeData | No |
Implementation Reference
- src/index.ts:1629-1660 (handler)Handler for executing the get-execution tool: validates client, calls N8nClient.getExecution, formats and returns the result or error.case "get-execution": { const { clientId, id, includeData } = args as { clientId: string; id: number; includeData?: boolean }; const client = clients.get(clientId); if (!client) { return { content: [{ type: "text", text: "Client not initialized. Please run init-n8n first.", }], isError: true }; } try { const execution = await client.getExecution(id, includeData); return { content: [{ type: "text", text: JSON.stringify(execution, null, 2), }] }; } catch (error) { return { content: [{ type: "text", text: error instanceof Error ? error.message : "Unknown error occurred", }], isError: true }; } }
- src/index.ts:711-718 (schema)Input schema definition for the get-execution tool, specifying parameters: clientId (required), id (required), includeData (optional).inputSchema: { type: "object", properties: { clientId: { type: "string" }, id: { type: "number" }, includeData: { type: "boolean" } }, required: ["clientId", "id"]
- src/index.ts:709-720 (registration)Tool registration in the ListTools response: defines name, description, and inputSchema for get-execution.name: "get-execution", description: "Retrieve a specific execution by ID.", inputSchema: { type: "object", properties: { clientId: { type: "string" }, id: { type: "number" }, includeData: { type: "boolean" } }, required: ["clientId", "id"] } },
- src/index.ts:285-290 (helper)N8nClient.getExecution method: constructs API request to fetch specific execution data from n8n, optionally including data.async getExecution(id: number, includeData: boolean = false): Promise<N8nExecution> { const params = new URLSearchParams(); if (includeData) params.append('includeData', 'true'); return this.makeRequest<N8nExecution>(`/executions/${id}?${params.toString()}`); }
- src/index.ts:61-72 (helper)TypeScript interface defining the structure of an n8n execution response.interface N8nExecution { id: number; data?: any; finished: boolean; mode: string; retryOf?: number; retrySuccessId?: number; startedAt: string; stoppedAt?: string; workflowId: number; waitTill?: string; }