Skip to main content
Glama

get-workflow

Retrieve detailed information about a specific workflow using its ID after listing workflows. Requires client ID and workflow ID as compact JSON input.

Instructions

Retrieve a workflow by ID. Use after list-workflows to get detailed information about a specific workflow. IMPORTANT: Arguments must be provided as compact, single-line JSON without whitespace or newlines.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
clientIdYes
idYes

Implementation Reference

  • MCP tool handler for 'get-workflow': validates clientId, retrieves N8nClient instance, calls client.getWorkflow(id), and returns the workflow JSON or error.
    case "get-workflow": {
      const { clientId, id } = args as { clientId: string; id: string };
      const client = clients.get(clientId);
      if (!client) {
        return {
          content: [{
            type: "text",
            text: "Client not initialized. Please run init-n8n first.",
          }],
          isError: true
        };
      }
    
      try {
        const workflow = await client.getWorkflow(id);
        return {
          content: [{
            type: "text",
            text: JSON.stringify(workflow, null, 2),
          }]
        };
      } catch (error) {
        return {
          content: [{
            type: "text",
            text: error instanceof Error ? error.message : "Unknown error occurred",
          }],
          isError: true
        };
      }
    }
  • src/index.ts:424-434 (registration)
    Tool registration in ListTools response, defining name, description, and input schema for 'get-workflow'.
      name: "get-workflow",
      description: "Retrieve a workflow by ID. Use after list-workflows to get detailed information about a specific workflow. IMPORTANT: Arguments must be provided as compact, single-line JSON without whitespace or newlines.",
      inputSchema: {
        type: "object",
        properties: {
          clientId: { type: "string" },
          id: { type: "string" }
        },
        required: ["clientId", "id"]
      }
    },
  • N8nClient helper method that performs the actual API call to fetch workflow by ID via makeRequest.
    async getWorkflow(id: string): Promise<N8nWorkflow> {
      return this.makeRequest<N8nWorkflow>(`/workflows/${id}`);
    }
  • TypeScript interface defining the structure of an N8n workflow object returned by the API.
    interface N8nWorkflow {
      id: number;
      name: string;
      active: boolean;
      createdAt: string;
      updatedAt: string;
      tags: string[];
    }

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

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