delete_issue
Remove an issue from Backlog using its ID or key to clean up project management data.
Instructions
Deletes an issue
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| issueId | No | The numeric ID of the issue (e.g., 12345) | |
| issueKey | No | The key of the issue (e.g., 'PROJ-123') | |
| organization | No | Optional organization name. Use list_organizations to inspect available organizations. |
Implementation Reference
- src/tools/deleteIssue.ts:26-46 (handler)The main handler function for the delete_issue tool. It accepts issueId or issueKey, resolves the identifier via resolveIdOrKey, then calls backlog.deleteIssue() to perform the deletion.
export const deleteIssueTool = ( backlog: Backlog, { t }: TranslationHelper ): ToolDefinition< ReturnType<typeof deleteIssueSchema>, (typeof IssueSchema)['shape'] > => { return { name: 'delete_issue', description: t('TOOL_DELETE_ISSUE_DESCRIPTION', 'Deletes an issue'), schema: z.object(deleteIssueSchema(t)), outputSchema: IssueSchema, handler: async ({ issueId, issueKey }) => { const result = resolveIdOrKey('issue', { id: issueId, key: issueKey }, t); if (!result.ok) { throw result.error; } return backlog.deleteIssue(result.value); }, }; }; - src/tools/deleteIssue.ts:8-24 (schema)Input schema for delete_issue tool, defining optional issueId (numeric) and issueKey (string) fields using buildToolSchema.
const deleteIssueSchema = buildToolSchema((t) => ({ issueId: z .number() .optional() .describe( t( 'TOOL_DELETE_ISSUE_ISSUE_ID', 'The numeric ID of the issue (e.g., 12345)' ) ), issueKey: z .string() .optional() .describe( t('TOOL_GET_ISSUE_ISSUE_KEY', "The key of the issue (e.g., 'PROJ-123')") ), })); - Output schema (IssueSchema) used as the return type for delete_issue - defines the structure of a Backlog issue object.
export const IssueSchema = z.object({ id: z.number(), projectId: z.number(), issueKey: z.string(), keyId: z.number(), issueType: IssueTypeSchema, summary: z.string(), description: z.string(), resolution: ResolutionSchema.optional(), priority: PrioritySchema, status: ProjectStatusSchema, assignee: UserSchema.optional(), category: z.array(CategorySchema), versions: z.array(VersionSchema), milestone: z.array(VersionSchema), startDate: z.string().optional(), dueDate: z.string().optional(), estimatedHours: z.number().optional(), actualHours: z.number().optional(), parentIssueId: z.number().optional(), createdUser: UserSchema, created: z.string(), updatedUser: UserSchema, updated: z.string(), customFields: z.array(CustomFieldSchema), attachments: z.array(IssueFileInfoSchema), sharedFiles: z.array(SharedFileSchema), stars: z.array(StarSchema), }); - src/tools/tools.ts:105-105 (registration)Registration of deleteIssueTool in the 'issue' toolset within the allTools function.
deleteIssueTool(backlog, helper), - src/utils/resolveIdOrKey.ts:51-55 (helper)The resolveIdOrKey helper used by delete_issue handler to resolve an issue by either numeric ID or string key.
export const resolveIdOrKey = <E extends EntityName>( entity: E, values: { id?: number; key?: string }, t: TranslationHelper['t'] ): ResolveResult => resolveIdOrField(entity, 'key', values, t);