transfer_project
Transfer a GitLab project to a different namespace, such as a user or group, by specifying the project ID and target namespace.
Instructions
Transfer a project to a new namespace.
Args:
project_id: GitLab project ID
namespace: Target namespace (user or group)
token: GitLab Personal Access Token (optional)
ctx: MCP context (automatically injected)Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| project_id | Yes | ||
| namespace | Yes | ||
| token | No | ||
| ctx | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- The 'transfer_project' tool function that transfers a GitLab project to a new namespace via the GitLab API. It takes project_id, namespace, optional token and ctx, and makes a PUT request to /projects/{project_id}/transfer.
async def transfer_project(project_id: int, namespace: str, token: str = None, ctx=None) -> str: """Transfer a project to a new namespace. Args: project_id: GitLab project ID namespace: Target namespace (user or group) token: GitLab Personal Access Token (optional) ctx: MCP context (automatically injected) """ data = {"namespace": namespace} result = await make_gitlab_request(f"/projects/{project_id}/transfer", "PUT", data, ctx=ctx, token=token) if isinstance(result, dict) and "error" in result: return f"Error transferring project: {result['error']}" return f"Project transferred: {result['name']} to {result['namespace']['full_path']}" - gitlab_clone_mcp_server/server.py:1248-1249 (registration)The '@mcp.tool()' decorator registers transfer_project as an MCP tool on the FastMCP server instance.
@mcp.tool() async def transfer_project(project_id: int, namespace: str, token: str = None, ctx=None) -> str: - The function signature and docstring define the input schema: project_id (int), namespace (str), token (optional str), ctx (optional, auto-injected).
async def transfer_project(project_id: int, namespace: str, token: str = None, ctx=None) -> str: """Transfer a project to a new namespace. Args: project_id: GitLab project ID namespace: Target namespace (user or group) token: GitLab Personal Access Token (optional) ctx: MCP context (automatically injected) """