create_issue
Creates a new issue in a GitLab project with required title and optional description.
Instructions
Create a new issue in a GitLab project.
Args:
project_id: GitLab project ID
title: Issue title
description: Issue description (optional)
token: GitLab Personal Access Token (optional)
ctx: MCP context (automatically injected)Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| project_id | Yes | ||
| title | Yes | ||
| description | No | ||
| token | No | ||
| ctx | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- The create_issue tool handler function. It takes project_id, title, description, token, and ctx parameters. It makes a POST request to GitLab API endpoint /projects/{project_id}/issues with the title and description, and returns the created issue info or an error message.
@mcp.tool() async def create_issue(project_id: int, title: str, description: str = "", token: str = None, ctx=None) -> str: """Create a new issue in a GitLab project. Args: project_id: GitLab project ID title: Issue title description: Issue description (optional) token: GitLab Personal Access Token (optional) ctx: MCP context (automatically injected) """ endpoint = f"/projects/{project_id}/issues" data = { "title": title, "description": description } result = await make_gitlab_request(endpoint, "POST", data, ctx=ctx, token=token) if isinstance(result, dict) and "error" in result: return f"Error creating issue: {result['error']}" return f"Issue created successfully: #{result['iid']} - {result['title']}" - gitlab_clone_mcp_server/server.py:171-171 (registration)The create_issue function is registered as an MCP tool via the @mcp.tool() decorator on line 171.
@mcp.tool()