Skip to main content
Glama

delete-workflow

Remove a specific workflow by ID using a single-line JSON input. Ensures immediate and irreversible deletion of the workflow from the MCP-N8N server.

Instructions

Delete a workflow by ID. This action cannot be undone. IMPORTANT: Arguments must be provided as compact, single-line JSON without whitespace or newlines.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
clientIdYes
idYes

Implementation Reference

  • Handler for the 'delete-workflow' tool call. Retrieves the N8nClient by clientId, calls deleteWorkflow(id), and returns success or error message.
    case "delete-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.deleteWorkflow(id);
        return {
          content: [{
            type: "text",
            text: `Successfully deleted workflow:\n${JSON.stringify(workflow, null, 2)}`,
          }]
        };
      } catch (error) {
        return {
          content: [{
            type: "text",
            text: error instanceof Error ? error.message : "Unknown error occurred",
          }],
          isError: true
        };
      }
    }
  • Input schema defining parameters for the delete-workflow tool: clientId and id, both required strings.
    inputSchema: {
      type: "object",
      properties: {
        clientId: { type: "string" },
        id: { type: "string" }
      },
      required: ["clientId", "id"]
    }
  • src/index.ts:471-482 (registration)
    Registration of the 'delete-workflow' tool in the list of available tools returned by ListToolsRequestHandler.
    {
      name: "delete-workflow",
      description: "Delete a workflow by ID. This action cannot be undone. 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"]
      }
    },
  • Helper method in N8nClient class that makes the DELETE API request to /workflows/{id} to delete the workflow.
    async deleteWorkflow(id: string): Promise<N8nWorkflow> {
      return this.makeRequest<N8nWorkflow>(`/workflows/${id}`, {
        method: 'DELETE',
      });
    }

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