get_project_forks
Retrieve all forks of a GitLab project by providing the project ID. Access fork details for project management.
Instructions
List forks of 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_forks' tool. Calls GitLab API /projects/{project_id}/forks and lists up to 10 forks with name, namespace, and ID.
async def get_project_forks(project_id: int, token: str = None, ctx=None) -> str: """List forks of 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}/forks", ctx=ctx, token=token) if isinstance(data, dict) and "error" in data: return f"Error: {data['error']}" if not data: return "No forks found." forks = [] for fork in data[:10]: forks.append(f"• {fork['name']} by {fork['namespace']['name']} - ID: {fork['id']}") return "\n".join(forks) - gitlab_clone_mcp_server/server.py:1225-1228 (registration)Registration of 'get_project_forks' as an MCP tool via the @mcp.tool() decorator on line 1225.
@mcp.tool() async def get_project_forks(project_id: int, token: str = None, ctx=None) -> str: """List forks of a project.