gitlab_add_webhook
Adds a new webhook to a GitLab project, enabling event triggers like push, merge requests, or issues. Configure SSL verification and a secret token for secure payload validation.
Instructions
Add a new webhook to a project
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| enable_ssl_verification | No | Enable SSL verification for the webhook | |
| issues_events | No | Trigger webhook for issues events | |
| merge_requests_events | No | Trigger webhook for merge request events | |
| project_id | Yes | The ID or URL-encoded path of the project | |
| push_events | No | Trigger webhook for push events | |
| token | No | Secret token to validate received payloads | |
| url | Yes | The webhook URL |
Input Schema (JSON Schema)
{
"properties": {
"enable_ssl_verification": {
"description": "Enable SSL verification for the webhook",
"type": "boolean"
},
"issues_events": {
"description": "Trigger webhook for issues events",
"type": "boolean"
},
"merge_requests_events": {
"description": "Trigger webhook for merge request events",
"type": "boolean"
},
"project_id": {
"description": "The ID or URL-encoded path of the project",
"type": "string"
},
"push_events": {
"description": "Trigger webhook for push events",
"type": "boolean"
},
"token": {
"description": "Secret token to validate received payloads",
"type": "string"
},
"url": {
"description": "The webhook URL",
"type": "string"
}
},
"required": [
"project_id",
"url"
],
"type": "object"
}
Implementation Reference
- The main handler function that executes the gitlab_add_webhook tool logic. It validates parameters and delegates to context.integrationsManager.addWebhook.export const addWebhook: ToolHandler = async (params, context) => { const { project_id, ...options } = params.arguments || {}; if (!project_id) { throw new McpError(ErrorCode.InvalidParams, 'project_id is required'); } if (!options.url) { throw new McpError(ErrorCode.InvalidParams, 'url is required for webhook'); } const data = await context.integrationsManager.addWebhook(project_id as string | number, options as { url: string; name?: string; description?: string; token?: string; push_events?: boolean; push_events_branch_filter?: string; issues_events?: boolean; confidential_issues_events?: boolean; merge_requests_events?: boolean; tag_push_events?: boolean; note_events?: boolean; confidential_note_events?: boolean; job_events?: boolean; pipeline_events?: boolean; wiki_page_events?: boolean; deployment_events?: boolean; releases_events?: boolean; feature_flag_events?: boolean; enable_ssl_verification?: boolean; custom_webhook_template?: string; custom_headers?: Array<{key: string; value?: string}>; }); return formatResponse(data); };
- src/utils/tools-data.ts:371-408 (schema)The input schema and description definition for the gitlab_add_webhook tool.{ name: 'gitlab_add_webhook', description: 'Add a new webhook to a project', inputSchema: { type: 'object', properties: { project_id: { type: 'string', description: 'The ID or URL-encoded path of the project' }, url: { type: 'string', description: 'The webhook URL' }, token: { type: 'string', description: 'Secret token to validate received payloads' }, push_events: { type: 'boolean', description: 'Trigger webhook for push events' }, issues_events: { type: 'boolean', description: 'Trigger webhook for issues events' }, merge_requests_events: { type: 'boolean', description: 'Trigger webhook for merge request events' }, enable_ssl_verification: { type: 'boolean', description: 'Enable SSL verification for the webhook' } }, required: ['project_id', 'url'] } },
- src/utils/tool-registry.ts:44-44 (registration)The registration of the gitlab_add_webhook tool mapping to its handler function integrationHandlers.addWebhook.gitlab_add_webhook: integrationHandlers.addWebhook,