get_project_users
Retrieve all users who have access to a specified GitLab project. Provide the project ID to list authorized users.
Instructions
Get users with access to a project.
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 handler function for the 'get_project_users' tool. It calls GitLab API endpoint /projects/{project_id}/users and returns a formatted list of users with their name, username, and state.
async def get_project_users(project_id: int, token: str = None, ctx=None) -> str: """Get users with access to a project. 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}/users", ctx=ctx, token=token) if isinstance(data, dict) and "error" in data: return f"Error: {data['error']}" if not data: return "No users found." users = [] for user in data[:15]: users.append(f"• {user['name']} (@{user['username']}) - {user['state']}") return "\n".join(users) - gitlab_clone_mcp_server/server.py:1266-1267 (registration)The tool is registered via the @mcp.tool() decorator on line 1266, which is the standard FastMCP registration pattern used throughout this server.
@mcp.tool() async def get_project_users(project_id: int, token: str = None, ctx=None) -> str: