Skip to main content
Glama

delete_workflow

Permanently remove a workflow by its ID from the MCP n8n-builder server. Use this irreversible action carefully; consider deactivating workflows if reuse is possible.

Instructions

Permanently deletes a workflow by its ID. This action cannot be undone, so use with caution. Consider deactivating workflows instead if you might need them again later.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesID of the workflow to delete - can be obtained from list_workflows

Implementation Reference

  • The handler function that executes the delete_workflow tool. It validates the workflow ID, retrieves the workflow details to include the name in the response, calls the API client to delete the workflow, and returns a success or error message.
    /** * Handles the delete_workflow tool */ export async function handle_delete_workflow( api_client: N8nApiClient, args: any, ) { if (!args.id) { throw new McpError( ErrorCode.InvalidParams, 'Workflow ID is required', ); } // First get the workflow to show its name try { const workflow = await api_client.get_workflow(args.id); // Now delete the workflow const result = await api_client.delete_workflow(args.id); return { content: [ { type: 'text', text: `Successfully deleted workflow "${workflow.name}" (ID: ${args.id})`, }, ], }; } catch (error: any) { return { content: [ { type: 'text', text: `Error deleting workflow: ${ error.message || String(error) }`, }, ], isError: true, }; } }
  • Registration of the 'delete_workflow' tool in the MCP server, including name, description, and input schema definition.
    name: 'delete_workflow', description: 'Permanently deletes a workflow by its ID. This action cannot be undone, so use with caution. Consider deactivating workflows instead if you might need them again later.', inputSchema: { type: 'object', properties: { id: { type: 'string', description: 'ID of the workflow to delete - can be obtained from list_workflows', }, }, required: ['id'], }, },
  • The switch case in the tool call handler that routes calls to 'delete_workflow' to the handle_delete_workflow function.
    case 'delete_workflow': return await handle_delete_workflow(api_client, args);
  • The N8nApiClient helper method that performs the actual HTTP DELETE request to delete the workflow from the n8n API.
    async delete_workflow(id: string): Promise<any> { return this.request<any>('DELETE', `/workflows/${id}`); }
  • Import of the handle_delete_workflow function from workflow-tools.js for use in tool registration.
    handle_delete_workflow,

Other Tools

Related Tools

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

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