gitlab_list_pipelines
Retrieve and filter CI/CD pipeline runs by branch or status to monitor execution and identify failures. Provides pipeline details like ID, status, ref, SHA, creation time, and duration for informed workflow management.
Instructions
List CI/CD pipelines Returns: Pipeline runs with status Use when: Checking CI status, finding failures Filtering: By ref (branch), status
Statuses:
running: Currently executing
pending: Waiting to start
success: Passed
failed: Failed
canceled: Manually canceled
skipped: Skipped
Example response: [{ "id": 123456, "status": "success", "ref": "main", "sha": "abc123...", "created_at": "2024-01-15T10:00:00Z", "duration": 300 }]
Related tools:
gitlab_get_pipeline: Full pipeline details
gitlab_summarize_pipeline: AI-friendly summary
Input 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 | |
| ref | No | Branch or tag name Type: string Format: Valid git reference name Optional: Yes Examples: - 'main' (main branch) - 'develop' (development branch) - 'feature/user-auth' (feature branch) - 'v1.0.0' (version tag) - 'release-2024.01' (release tag) |
Implementation Reference
- src/mcp_gitlab/tool_handlers.py:244-250 (handler)The core handler function that implements the gitlab_list_pipelines tool. It resolves the project ID (auto-detecting from git if not provided), extracts the optional ref parameter, and delegates to the GitLabClient's get_pipelines method to fetch the list of pipelines.def handle_list_pipelines(client: GitLabClient, arguments: Optional[Dict[str, Any]]) -> Any: """Handle listing pipelines""" project_id = require_project_id(client, arguments) ref = get_argument(arguments, "ref") return client.get_pipelines(project_id, ref)
- src/mcp_gitlab/tool_handlers.py:1008-1010 (registration)Registration of the handler function in the TOOL_HANDLERS dictionary, mapping the tool name TOOL_LIST_PIPELINES ("gitlab_list_pipelines") to handle_list_pipelines.TOOL_LIST_PIPELINES: handle_list_pipelines, TOOL_LIST_USER_EVENTS: handle_get_user_events, TOOL_LIST_COMMITS: handle_get_commits,
- src/mcp_gitlab/server.py:507-516 (schema)Tool schema definition and registration in the MCP server's list_tools handler, specifying the input schema with optional project_id and ref parameters.name=TOOL_LIST_PIPELINES, description=desc.DESC_LIST_PIPELINES, inputSchema={ "type": "object", "properties": { "project_id": {"type": "string", "description": desc.DESC_PROJECT_ID}, "ref": {"type": "string", "description": desc.DESC_BRANCH_TAG_REF} } } ),
- src/mcp_gitlab/server.py:1251-1256 (registration)The central tool dispatch logic in the MCP server's call_tool handler, which looks up the handler function from TOOL_HANDLERS by tool name and executes it with the GitLab client and arguments.handler = TOOL_HANDLERS.get(name) if not handler: raise ValueError(f"Unknown tool: {name}") # Execute the handler result = handler(client, arguments)
- Helper function used by the handler to resolve or auto-detect the project_id from arguments or current git repository, raising an error if not 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