Skip to main content
Glama

get_workflow

Retrieve a specific n8n workflow using its unique ID to access workflow details and configuration for automation processes.

Instructions

Get a specific n8n workflow by ID

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesThe workflow ID

Implementation Reference

  • Primary MCP tool handler for 'get_workflow'. Resolves workflow ID (handling numeric aliases), fetches via N8nClient, augments with alias, and returns JSON response.
    private async handleGetWorkflow(args: { id: string | number }) { const id = this.resolveWorkflowId(args.id); const workflow = await this.n8nClient.getWorkflow(id); this.withAlias(workflow); return { content: [{ type: 'text', text: JSON.stringify(jsonSuccess(workflow), null, 2) }] }; }
  • src/index.ts:70-70 (registration)
    Tool registration including name, description, and input schema definition.
    { name: 'get_workflow', description: 'Get a specific n8n workflow by ID', inputSchema: { type: 'object', properties: { id: { oneOf: [{ type: 'string' }, { type: 'number' }], description: 'The workflow ID' } }, required: ['id'] } },
  • Core N8nClient method implementing the HTTP GET request to retrieve workflow by ID.
    async getWorkflow(id: string | number): Promise<N8nWorkflow> { const response = await this.api.get<N8nApiResponse<N8nWorkflow> | N8nWorkflow>(`/workflows/${id}`); const payload: any = response.data as any; return (payload && typeof payload === 'object' && 'data' in payload) ? payload.data : payload; }
  • Helper function to resolve numeric workflow ID aliases to actual string IDs.
    private resolveWorkflowId(id: string | number): string | number { if (typeof id === 'number') { const real = this.workflowIdAliasToString.get(id); return real ?? id; } return id; }
  • Helper to attach stable numeric ID aliases to workflow objects for client convenience.
    private withAlias<T extends N8nWorkflow | N8nWorkflow[]>(payload: T): T { const attach = (wf: N8nWorkflow) => { const alias = this.registerWorkflowAlias(wf.id as any); if (alias != null) { // non-destructive augmentation (wf as any).numericId = alias; } }; if (Array.isArray(payload)) { payload.forEach(attach); } else { attach(payload as N8nWorkflow); } return payload; }

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/get2knowio/n8n-mcp'

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