webhook_urls
Retrieve webhook URLs for specific workflow nodes to enable external trigger configurations and API integrations within n8n automation workflows.
Instructions
Get webhook URLs for a webhook node in a workflow
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| nodeId | Yes | ||
| workflowId | Yes |
Implementation Reference
- src/index.ts:498-502 (handler)MCP server tool handler for 'webhook_urls' that resolves the workflow ID alias and delegates to N8nClient.getWebhookUrlsprivate async handleWebhookUrls(args: { workflowId: string | number; nodeId: string }) { const workflowId = this.resolveWorkflowId(args.workflowId); const urls = await this.n8nClient.getWebhookUrls(workflowId, args.nodeId); return { content: [{ type: 'text', text: JSON.stringify(jsonSuccess(urls), null, 2) }] }; }
- src/index.ts:199-199 (registration)Registration of the 'webhook_urls' tool in the MCP server's listTools response, including input schema{ name: 'webhook_urls', description: 'Get webhook URLs for a webhook node in a workflow', inputSchema: { type: 'object', properties: { workflowId: { oneOf: [{ type: 'string' }, { type: 'number' }] }, nodeId: { type: 'string' } }, required: ['workflowId', 'nodeId'] } },
- src/n8n-client.ts:753-765 (handler)Core handler logic in N8nClient that fetches the workflow, validates the webhook node, extracts the path parameter, and constructs testUrl and productionUrlasync getWebhookUrls(workflowId: string | number, nodeId: string): Promise<N8nWebhookUrls> { const workflow = await this.getWorkflow(workflowId); const webhookNode = workflow.nodes.find((node) => node.id === nodeId); if (!webhookNode) throw new Error(`Node with ID '${nodeId}' not found in workflow ${workflowId}`); if (webhookNode.type !== 'n8n-nodes-base.webhook') { throw new Error(`Node '${nodeId}' is not a webhook node (type: ${webhookNode.type})`); } const path = webhookNode.parameters?.path || ''; if (!path) throw new Error(`Webhook node '${nodeId}' does not have a path configured`); const testUrl = `${this.baseUrl}/webhook-test/${path}`; const productionUrl = `${this.baseUrl}/webhook/${path}`; return { testUrl, productionUrl }; }
- src/types.ts:291-294 (schema)Type definition for the output of webhook_urls toolexport interface N8nWebhookUrls { testUrl: string; productionUrl: string; }