get_repository_tags
Retrieve all tags from a GitLab repository by providing the project ID.
Instructions
Get repository tags.
Args:
project_id: GitLab project ID
token: GitLab Personal Access Token (optional)
ctx: MCP context (automatically injected)Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| project_id | Yes | ||
| token | No | ||
| ctx | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- The actual handler function for the 'get_repository_tags' tool. It calls the GitLab API endpoint /projects/{project_id}/repository/tags to fetch tags and returns them formatted with name, commit short_id, and message.
@mcp.tool() async def get_repository_tags(project_id: int, token: str = None, ctx=None) -> str: """Get repository tags. Args: project_id: GitLab project ID token: GitLab Personal Access Token (optional) ctx: MCP context (automatically injected) """ data = await make_gitlab_request(f"/projects/{project_id}/repository/tags", ctx=ctx, token=token) if isinstance(data, dict) and "error" in data: return f"Error: {data['error']}" if not data: return "No tags found." tags = [] for tag in data[:10]: tags.append(f"• {tag['name']} - {tag['commit']['short_id']} ({tag.get('message', 'No message')})") return "\n".join(tags) - gitlab_clone_mcp_server/server.py:822-823 (registration)The tool is registered as an MCP tool via the @mcp.tool() decorator on line 822.
@mcp.tool() async def get_repository_tags(project_id: int, token: str = None, ctx=None) -> str: