gitlab_close_issue
Close a GitLab issue by specifying the project path and issue internal ID. This tool helps manage issue resolution within GitLab projects.
Instructions
Closes a GitLab issue.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| projectPath | Yes | The path of the GitLab project. | |
| issueIid | Yes | The internal ID of the issue. |
Implementation Reference
- src/index.ts:926-942 (registration)Tool registration and input schema definition for 'gitlab_close_issue'{ name: 'gitlab_close_issue', description: 'Closes a GitLab issue.', inputSchema: { type: 'object', properties: { projectPath: { type: 'string', description: 'The path of the GitLab project.', }, issueIid: { type: 'number', description: 'The internal ID of the issue.', }, }, required: ['projectPath', 'issueIid'], },
- src/index.ts:2034-2048 (handler)MCP tool handler that dispatches the call to GitLabService.closeIssuecase 'gitlab_close_issue': { if (!gitlabService) { throw new Error('GitLab service is not initialized.'); } const { projectPath, issueIid } = args as { projectPath: string; issueIid: number }; const result = await gitlabService.closeIssue(projectPath, issueIid); return { content: [ { type: 'text', text: `Issue closed successfully: ${JSON.stringify(result, null, 2)}`, }, ], }; }
- src/gitlab.service.ts:701-704 (handler)GitLabService.closeIssue method implementing the core tool logic by calling updateIssue// New tool: Close Issue async closeIssue(projectPath: string, issueIid: number): Promise<any> { return this.updateIssue(projectPath, issueIid, { state: 'close' }); }
- src/gitlab.service.ts:678-698 (helper)Generic updateIssue helper method that sends PUT request to GitLab API, used by closeIssue to set state_event to 'close'async updateIssue(projectPath: string, issueIid: number, updates: { title?: string; description?: string; labels?: string[]; assigneeIds?: number[]; state?: 'close' | 'reopen'; }): Promise<any> { const encodedProjectPath = encodeURIComponent(projectPath); const body: any = {}; if (updates.title) body.title = updates.title; if (updates.description) body.description = updates.description; if (updates.labels) body.labels = updates.labels.join(','); if (updates.assigneeIds) body.assignee_ids = updates.assigneeIds; if (updates.state) body.state_event = updates.state; return this.callGitLabApi<any>( `projects/${encodedProjectPath}/issues/${issueIid}`, 'PUT', body, );