deactivate_workflow
Deactivate a specific workflow by ID to stop automatic execution while retaining it for manual use or future reactivation. Ideal for temporarily pausing workflows without deletion.
Instructions
Deactivates a workflow by its ID, preventing it from running automatically. The workflow will still exist and can be manually executed or reactivated later. Use this instead of deleting workflows that you might need again.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | ID of the workflow to deactivate - can be obtained from list_workflows |
Input Schema (JSON Schema)
{
"properties": {
"id": {
"description": "ID of the workflow to deactivate - can be obtained from list_workflows",
"type": "string"
}
},
"required": [
"id"
],
"type": "object"
}
Implementation Reference
- The primary handler function that implements the deactivate_workflow tool logic. It validates the workflow ID, calls the N8nApiClient to perform the deactivation, and returns a formatted success or error message.* Handles the deactivate_workflow tool */ export async function handle_deactivate_workflow( api_client: N8nApiClient, args: any, ) { if (!args.id) { throw new McpError( ErrorCode.InvalidParams, 'Workflow ID is required', ); } try { const result = await api_client.deactivate_workflow(args.id); return { content: [ { type: 'text', text: `Successfully deactivated workflow "${result.name}" (ID: ${args.id})`, }, ], }; } catch (error: any) { return { content: [ { type: 'text', text: `Error deactivating workflow: ${ error.message || String(error) }`, }, ], isError: true, }; } }
- src/tool-handlers/index.ts:234-249 (schema)Defines the tool's input schema, specifying that it requires a 'id' string parameter for the workflow ID.{ name: 'deactivate_workflow', description: 'Deactivates a workflow by its ID, preventing it from running automatically. The workflow will still exist and can be manually executed or reactivated later. Use this instead of deleting workflows that you might need again.', inputSchema: { type: 'object', properties: { id: { type: 'string', description: 'ID of the workflow to deactivate - can be obtained from list_workflows', }, }, required: ['id'], }, },
- src/tool-handlers/index.ts:332-333 (registration)Wires the deactivate_workflow tool name to the handle_deactivate_workflow function in the central tool dispatching switch statement.case 'deactivate_workflow': return await handle_deactivate_workflow(api_client, args);
- src/n8n-api-client.ts:164-169 (helper)Helper method in the N8nApiClient class that performs the actual HTTP POST request to the n8n API endpoint to deactivate the specified workflow./** * Deactivate a workflow */ async deactivate_workflow(id: string): Promise<any> { return this.request<any>('POST', `/workflows/${id}/deactivate`); }