Skip to main content
Glama
spences10

mcp-n8n-builder

activate_workflow

Enable automatic execution of a workflow by its ID using triggers like schedules or webhooks. Only workflows with automatic triggers can be activated.

Instructions

Activates a workflow by its ID, enabling it to run automatically based on its trigger (schedule, webhook, etc.). Note that only workflows with automatic trigger nodes can be activated - workflows with only manual triggers cannot be activated.

Input Schema

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

Implementation Reference

  • The handler function that implements the core logic for the 'activate_workflow' MCP tool. It validates the input arguments, calls the N8nApiClient to activate the workflow, formats the response, and handles specific errors like missing triggers with helpful guidance.
     * Handles the activate_workflow tool
     */
    export async function handle_activate_workflow(
    	api_client: N8nApiClient,
    	args: any,
    ) {
    	if (!args.id) {
    		throw new McpError(
    			ErrorCode.InvalidParams,
    			'Workflow ID is required',
    		);
    	}
    
    	try {
    		const result = await api_client.activate_workflow(args.id);
    		return {
    			content: [
    				{
    					type: 'text',
    					text: `Successfully activated workflow "${result.name}" (ID: ${args.id})`,
    				},
    			],
    		};
    	} catch (error: any) {
    		// Check for common activation errors
    		if (error.message && error.message.includes('trigger')) {
    			// This is likely an error about missing trigger nodes
    			const core_principles =
    				WORKFLOW_COMPOSITION_GUIDE.core_principles;
    
    			return {
    				content: [
    					{
    						type: 'text',
    						text:
    							`Error activating workflow: ${error.message}\n\n` +
    							`Note: Only workflows with automatic trigger nodes (Schedule, Webhook, etc.) can be activated. ` +
    							`Workflows with only manual triggers cannot be automatically activated.\n\n` +
    							`Here are some core principles for workflow composition:\n${core_principles}`,
    					},
    				],
    				isError: true,
    			};
    		}
    
    		return {
    			content: [
    				{
    					type: 'text',
    					text: `Error activating workflow: ${
    						error.message || String(error)
    					}`,
    				},
    			],
    			isError: true,
    		};
    	}
    }
  • Tool registration in the list_tools handler, defining the name, description, and input schema for 'activate_workflow'.
    {
    	name: 'activate_workflow',
    	description:
    		'Activates a workflow by its ID, enabling it to run automatically based on its trigger (schedule, webhook, etc.). Note that only workflows with automatic trigger nodes can be activated - workflows with only manual triggers cannot be activated.',
    	inputSchema: {
    		type: 'object',
    		properties: {
    			id: {
    				type: 'string',
    				description:
    					'ID of the workflow to activate - can be obtained from list_workflows',
    			},
    		},
    		required: ['id'],
    	},
    },
  • Dispatch logic in the call_tool handler that routes 'activate_workflow' calls to the handle_activate_workflow function.
    case 'activate_workflow':
    	return await handle_activate_workflow(api_client, args);
  • Supporting helper method in the N8nApiClient class that makes the actual HTTP POST request to the n8n API to activate a workflow by ID.
    async activate_workflow(id: string): Promise<any> {
    	return this.request<any>('POST', `/workflows/${id}/activate`);
    }
Install Server

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