get-execution
Retrieve a specific n8n workflow execution by ID to access its details and data for analysis or troubleshooting.
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-1659 (handler)Handler for the 'get-execution' tool. Retrieves the N8nClient instance using clientId, calls getExecution on it with the provided id and optional includeData, and returns the execution data as JSON or an 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:708-720 (schema)Input schema and registration of the 'get-execution' tool in the listTools response, defining parameters: clientId (string, required), id (number, required), includeData (boolean, optional).{ 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 method that implements the core logic: makes an API request to `/executions/${id}` with optional includeData parameter to fetch the execution details from n8n.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 N8nExecution object returned by the getExecution method.interface N8nExecution { id: number; data?: any; finished: boolean; mode: string; retryOf?: number; retrySuccessId?: number; startedAt: string; stoppedAt?: string; workflowId: number; waitTill?: string; }