Skip to main content
Glama

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

TableJSON Schema
NameRequiredDescriptionDefault
enable_ssl_verificationNoEnable SSL verification for the webhook
issues_eventsNoTrigger webhook for issues events
merge_requests_eventsNoTrigger webhook for merge request events
project_idYesThe ID or URL-encoded path of the project
push_eventsNoTrigger webhook for push events
tokenNoSecret token to validate received payloads
urlYesThe webhook URL

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);
    };
  • 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']
      }
    },
  • The registration of the gitlab_add_webhook tool mapping to its handler function integrationHandlers.addWebhook.
    gitlab_add_webhook: integrationHandlers.addWebhook,

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/rifqi96/mcp-gitlab'

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