Delete Issue
delete_issueRemove a GitLab issue from a project using its project path and issue IID. Requires authentication with delete permissions.
Instructions
Delete a GitLab issue. Requires a user token with permission to delete issues in the project (typically the issue author or a maintainer).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| projectPath | Yes | Full path of the project (e.g., "group/project-name") | |
| iid | Yes | Issue IID (the number shown in the GitLab UI, e.g. "42") | |
| userCredentials | No | Your GitLab credentials (optional — falls back to the configured env token if not provided) |
Implementation Reference
- src/tools.ts:352-372 (handler)The Tool definition for 'delete_issue' with its handler function. Validates input (projectPath, iid), requires user authentication, and calls client.destroyIssue(). Returns {projectPath, iid, deleted: true}.
const deleteIssueTool: Tool = { name: 'delete_issue', title: 'Delete Issue', description: 'Delete a GitLab issue. Requires a user token with permission to delete issues in the project (typically the issue author or a maintainer).', requiresAuth: true, requiresWrite: true, annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: true }, inputSchema: withUserAuth(z.object({ projectPath: z.string().min(1).describe('Full path of the project (e.g., "group/project-name")'), iid: z.string().min(1).describe('Issue IID (the number shown in the GitLab UI, e.g. "42")'), })), handler: async (input, client, userConfig) => { const credentials = input.userCredentials ? validateUserConfig(input.userCredentials) : userConfig; if (!credentials) { throw new Error('User authentication is required for deleting issues.'); } await client.destroyIssue(input.projectPath.trim(), input.iid.trim(), credentials); return { projectPath: input.projectPath, iid: input.iid, deleted: true }; }, }; - src/tools.ts:360-363 (schema)Input schema for delete_issue: requires projectPath (string) and iid (string), wrapped with user authentication fields.
inputSchema: withUserAuth(z.object({ projectPath: z.string().min(1).describe('Full path of the project (e.g., "group/project-name")'), iid: z.string().min(1).describe('Issue IID (the number shown in the GitLab UI, e.g. "42")'), })), - src/gitlab-client.ts:2046-2061 (helper)The destroyIssue helper method in GitLabGraphQLClient. Uses the GitLab REST API (DELETE /projects/:id/issues/:iid) because GitLab's GraphQL schema does not expose a destroyIssue mutation. Requires a user token.
/** * Destroy an issue. Uses the REST API (DELETE /projects/:id/issues/:iid) * because GitLab's GraphQL schema does not expose a destroyIssue mutation. * Requires a user token (or GITLAB_TOKEN if configured as the env fallback). */ async destroyIssue( projectPath: string, iid: string, userConfig?: UserConfig ): Promise<void> { const encodedPath = encodeURIComponent(projectPath); await this.restRequest('DELETE', `/projects/${encodedPath}/issues/${iid}`, { userConfig, requiresWrite: true, }); } - src/tools.ts:2335-2341 (registration)The deleteIssueTool is registered in the exported 'tools' array, making it available to the MCP server.
export const tools: Tool[] = [ ...readOnlyTools, ...userAuthTools, ...writeTools, updateIssueTool, deleteIssueTool, updateMergeRequestTool,