Skip to main content
Glama

delete_workflow

Remove an n8n workflow from the testing environment using its ID to clean up test workflows and manage workflow inventory.

Instructions

Delete an n8n workflow by ID.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
workflowIdYes

Implementation Reference

  • The deleteWorkflow function makes a DELETE request to the n8n API to delete a workflow by ID. It constructs the API URL, sends the request with proper headers, and returns a confirmation object with deleted: true and the workflowId.
    export async function deleteWorkflow(workflowId: string) {
      const { baseUrl } = getEnv();
      const response = await fetch(`${baseUrl}/api/v1/workflows/${workflowId}`, {
        method: 'DELETE',
        headers: buildHeaders(),
      });
      if (!response.ok) throw new Error(`n8n API returned ${response.status}`);
      return { deleted: true, workflowId };
    }
  • src/index.ts:68-75 (registration)
    Tool registration for 'delete_workflow' with description 'Delete an n8n workflow by ID.' and input schema defining a required workflowId string property.
      name: 'delete_workflow',
      description: 'Delete an n8n workflow by ID.',
      inputSchema: {
        type: 'object',
        properties: { workflowId: { type: 'string' } },
        required: ['workflowId'],
      },
    },
  • Handler for 'delete_workflow' tool calls - validates the workflowId argument using Zod schema, calls the deleteWorkflow function, and returns the result as JSON text content.
    if (name === 'delete_workflow') {
      const { workflowId } = z.object({ workflowId: z.string() }).parse(args);
      const deleted = await deleteWorkflow(workflowId);
      return { content: [{ type: 'text', text: JSON.stringify(deleted, null, 2) }] };
    }

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/Souzix76/n8n-workflow-tester-safe'

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