Skip to main content
Glama

activate

Activate or deactivate n8n workflows to control automation execution and manage workflow states within the McFlow server.

Instructions

Activate or deactivate a workflow in n8n

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesWorkflow ID
activeYesSet to true to activate, false to deactivate

Implementation Reference

  • The handler function for the 'activate' tool in the ToolHandler class's handleTool method. It delegates to n8nManager.updateWorkflowStatus with the provided workflow ID and active status.
    case 'activate': return await this.n8nManager.updateWorkflowStatus( args?.id as string, args?.active as boolean );
  • Defines the tool schema including name, description, and input schema (requires id and active boolean) for the 'activate' tool.
    name: 'activate', description: 'Activate or deactivate a workflow in n8n', inputSchema: { type: 'object', properties: { id: { type: 'string', description: 'Workflow ID', }, active: { type: 'boolean', description: 'Set to true to activate, false to deactivate', }, }, required: ['id', 'active'], }, },
  • Registers all tools, including 'activate', by providing getToolDefinitions() in response to ListToolsRequestSchema in the MCP server setup.
    this.server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: getToolDefinitions(), }));
  • The core helper function that executes the n8n CLI command to activate or deactivate a workflow by ID and returns success/error messages.
    async updateWorkflowStatus(id: string, activate: boolean): Promise<any> { try { const command = activate ? `n8n update:workflow --id=${id} --activate` : `n8n update:workflow --id=${id} --deactivate`; console.error(`Executing: ${command}`); const { stdout, stderr } = await execAsync(command); if (this.hasRealError(stderr, stdout)) { throw new Error(stderr); } return { content: [ { type: 'text', text: `βœ… Workflow ${activate ? 'activated' : 'deactivated'} successfully!\n\n` + `πŸ†” Workflow ID: ${id}\n` + `${activate ? '▢️ Status: Active' : '⏸️ Status: Inactive'}\n`, }, ], }; } catch (error: any) { throw new Error(`Failed to update workflow status: ${error.message}`); } }

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/mckinleymedia/mcflow-mcp'

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