gitlab_list_project_hooks
Use this tool to list configured webhooks for a GitLab project. It displays URLs, events, and configuration details, helping you verify integrations and ensure proper setup.
Instructions
List project webhooks Returns: Configured webhooks Use when: Checking integrations Shows: URLs, events, configuration
Example response: [{ "id": 1, "url": "https://example.com/hook", "push_events": true, "issues_events": true, "merge_requests_events": true, "wiki_page_events": false }]
Related tools:
gitlab_create_project_hook: Add webhook
gitlab_test_project_hook: Test webhook
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| project_id | No | Project identifier (auto-detected if not provided) Type: integer OR string Format: numeric ID or 'namespace/project' Optional: Yes - auto-detects from current git repository Examples: - 12345 (numeric ID) - 'gitlab-org/gitlab' (namespace/project path) - 'my-group/my-subgroup/my-project' (nested groups) Note: If in a git repo with GitLab remote, this can be omitted |
Implementation Reference
- src/mcp_gitlab/tool_handlers.py:419-424 (handler)The main handler function that executes the gitlab_list_project_hooks tool. It resolves the project ID (from arguments or git detection) and calls the GitLabClient's get_project_hooks method to retrieve the list of project webhooks/hooks.def handle_get_project_hooks(client: GitLabClient, arguments: Optional[Dict[str, Any]]) -> List[Dict[str, Any]]: """Handle getting project webhooks""" project_id = require_project_id(client, arguments) return client.get_project_hooks(project_id)
- src/mcp_gitlab/tool_handlers.py:1015-1015 (registration)TOOL_HANDLERS dictionary entry that registers the tool name 'gitlab_list_project_hooks' to its handler function. This mapping is used by the MCP server to dispatch tool calls.TOOL_LIST_PROJECT_HOOKS: handle_get_project_hooks,
- Tool definition including name, description, and input schema (JSON Schema for parameters). Defines 'project_id' as optional string (auto-detected if missing). Used for validation and documentation.name=TOOL_LIST_PROJECT_HOOKS, description=desc.DESC_LIST_PROJECT_HOOKS, inputSchema={ "type": "object", "properties": { "project_id": {"type": "string", "description": desc.DESC_PROJECT_ID} } } ),
- src/mcp_gitlab/server.py:734-742 (registration)MCP server registration of the tool via @server.list_tools(), providing the schema for MCP protocol compliance.name=TOOL_LIST_PROJECT_HOOKS, description=desc.DESC_LIST_PROJECT_HOOKS, inputSchema={ "type": "object", "properties": { "project_id": {"type": "string", "description": desc.DESC_PROJECT_ID} } } ),
- Helper function used by the handler to resolve or detect the project_id, raising an error if none found."""Get project_id or raise error if not found""" project_id = get_project_id_or_detect(client, arguments) if not project_id: raise ValueError(ERROR_NO_PROJECT) return project_id