Skip to main content
Glama

n8n_trigger_webhook

Trigger active n8n workflows by sending HTTP requests to their webhook URLs with custom data and headers.

Instructions

Trigger a workflow via its webhook URL. The workflow must be active and have a Webhook trigger node.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
webhookUrlYesFull webhook URL (e.g., https://n8n.example.com/webhook/xxx-xxx-xxx)
methodNoHTTP method (default: POST)
dataNoData to send with the webhook request
headersNoAdditional HTTP headers

Implementation Reference

  • The main tool handler function for n8n_trigger_webhook that validates input arguments and calls N8nApiClient.triggerWebhook to execute the webhook trigger.
    n8n_trigger_webhook: async (
      client: N8nApiClient,
      args: Record<string, unknown>
    ): Promise<ToolResult> => {
      const webhookUrl = args.webhookUrl as string;
      if (!webhookUrl) {
        throw new Error('Webhook URL is required');
      }
    
      const result = await client.triggerWebhook(webhookUrl, {
        method: (args.method as 'GET' | 'POST' | 'PUT' | 'DELETE') || 'POST',
        data: args.data as Record<string, unknown> | undefined,
        headers: args.headers as Record<string, string> | undefined,
      });
    
      return {
        content: [
          {
            type: 'text' as const,
            text: JSON.stringify({
              success: true,
              message: 'Webhook triggered successfully',
              response: result,
            }, null, 2),
          },
        ],
      };
    },
  • The tool definition object containing the name, description, and input schema validation for n8n_trigger_webhook.
    {
      name: 'n8n_trigger_webhook',
      description: 'Trigger a workflow via its webhook URL. The workflow must be active and have a Webhook trigger node.',
      inputSchema: {
        type: 'object',
        properties: {
          webhookUrl: {
            type: 'string',
            description: 'Full webhook URL (e.g., https://n8n.example.com/webhook/xxx-xxx-xxx)',
          },
          method: {
            type: 'string',
            enum: ['GET', 'POST', 'PUT', 'DELETE'],
            description: 'HTTP method (default: POST)',
          },
          data: {
            type: 'object',
            description: 'Data to send with the webhook request',
          },
          headers: {
            type: 'object',
            description: 'Additional HTTP headers',
          },
        },
        required: ['webhookUrl'],
      },
    },
  • src/server.ts:127-131 (registration)
    Registration and dispatch logic in the MCP server's handleToolCall method that routes calls to 'n8n_trigger_webhook' to the corresponding handler in executionToolHandlers.
    // Execution tools
    if (name in executionToolHandlers) {
      const handler = executionToolHandlers[name as keyof typeof executionToolHandlers];
      return handler(client, args);
    }
  • Supporting utility method in N8nApiClient that performs the HTTP fetch request to the provided webhook URL, handling method, data, headers, and response parsing.
    async triggerWebhook(
      webhookUrl: string,
      options?: {
        method?: 'GET' | 'POST' | 'PUT' | 'DELETE';
        data?: Record<string, unknown>;
        headers?: Record<string, string>;
      }
    ): Promise<unknown> {
      const method = options?.method || 'POST';
      
      logger.debug(`Triggering webhook: ${method} ${webhookUrl}`);
    
      const fetchOptions: RequestInit = {
        method,
        headers: {
          'Content-Type': 'application/json',
          ...(options?.headers || {}),
        },
      };
    
      if (options?.data && method !== 'GET') {
        fetchOptions.body = JSON.stringify(options.data);
      }
    
      try {
        const response = await fetch(webhookUrl, fetchOptions);
        
        const text = await response.text();
        
        if (!response.ok) {
          throw new Error(`Webhook error: HTTP ${response.status} - ${text}`);
        }
    
        try {
          return JSON.parse(text);
        } catch {
          return { response: text };
        }
      } catch (error) {
        if (error instanceof Error) {
          logger.error(`Webhook error: ${error.message}`);
          throw error;
        }
        throw new Error('Unknown webhook error');
      }
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It mentions prerequisites (active workflow, Webhook trigger node) but lacks details on behavioral traits like error handling, response format, rate limits, authentication needs, or side effects. For a tool that likely makes external HTTP calls, this is a significant gap in transparency.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is front-loaded with the core purpose in the first sentence and adds essential prerequisites in the second. Both sentences earn their place by providing critical information without redundancy or fluff, making it efficient and well-structured.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (triggering external workflows via HTTP) and lack of annotations or output schema, the description is incomplete. It covers the basic purpose and prerequisites but omits details on behavior, response handling, and error scenarios, which are important for an agent to use this tool effectively.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents all parameters thoroughly. The description does not add any parameter-specific information beyond what the schema provides, such as examples for data format or header usage. Baseline 3 is appropriate when the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the specific action ('Trigger a workflow') and mechanism ('via its webhook URL'), with explicit mention of prerequisites ('workflow must be active and have a Webhook trigger node'). It distinguishes from siblings like n8n_activate_workflow or n8n_create_workflow by focusing on webhook-based triggering rather than workflow management.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides clear context on when to use this tool (when triggering via webhook URL) and includes prerequisites (active workflow with Webhook trigger node). However, it does not explicitly state when not to use it or name specific alternatives among the sibling tools, such as n8n_activate_workflow for activation without triggering.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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/alicankiraz1/cursor-n8n-builder'

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