linear_removeIssueLabel
Remove a label from an issue in Linear to maintain accurate issue categorization and organization within your project management workflow.
Instructions
Remove a label from an issue in Linear
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| issueId | Yes | ID or identifier of the issue to remove the label from (e.g., ABC-123) | |
| labelId | Yes | ID of the label to remove from the issue |
Implementation Reference
- The main handler function that executes the tool logic: validates input arguments using type guard and calls the LinearService to remove the label from the issue.export function handleRemoveIssueLabel(linearService: LinearService) { return async (args: unknown) => { try { if (!isRemoveIssueLabelArgs(args)) { throw new Error('Invalid arguments for removeIssueLabel'); } return await linearService.removeIssueLabel(args.issueId, args.labelId); } catch (error) { logError('Error removing label from issue', error); throw error; } }; }
- The MCP tool definition including name, description, input schema (issueId and labelId required), and output schema.export const removeIssueLabelToolDefinition: MCPToolDefinition = { name: 'linear_removeIssueLabel', description: 'Remove a label from an issue in Linear', input_schema: { type: 'object', properties: { issueId: { type: 'string', description: 'ID or identifier of the issue to remove the label from (e.g., ABC-123)', }, labelId: { type: 'string', description: 'ID of the label to remove from the issue', }, }, required: ['issueId', 'labelId'], }, output_schema: { type: 'object', properties: { success: { type: 'boolean' }, issueId: { type: 'string' }, labelId: { type: 'string' }, }, }, };
- src/tools/handlers/index.ts:109-110 (registration)Registration of the tool handler in the registerToolHandlers function, mapping 'linear_removeIssueLabel' to handleRemoveIssueLabel.linear_addIssueLabel: handleAddIssueLabel(linearService), linear_removeIssueLabel: handleRemoveIssueLabel(linearService),
- src/tools/type-guards.ts:243-255 (helper)Type guard function to validate the input arguments for the tool (issueId and labelId as strings).export function isRemoveIssueLabelArgs(args: unknown): args is { issueId: string; labelId: string; } { return ( typeof args === 'object' && args !== null && 'issueId' in args && typeof (args as { issueId: string }).issueId === 'string' && 'labelId' in args && typeof (args as { labelId: string }).labelId === 'string' ); }
- Core service method implementing the label removal: fetches the issue and current labels, filters out the target label, and updates the issue using Linear SDK.async removeIssueLabel(issueId: string, labelId: string) { // Get the issue const issue = await this.client.issue(issueId); if (!issue) { throw new Error(`Issue not found: ${issueId}`); } // Get the current labels const currentLabels = await issue.labels(); const currentLabelIds = currentLabels.nodes.map((label) => label.id); // Filter out the label ID to remove const updatedLabelIds = currentLabelIds.filter((id) => id !== labelId); // Only update if the label was actually present if (currentLabelIds.length !== updatedLabelIds.length) { await issue.update({ labelIds: updatedLabelIds, }); } return { success: true, issueId: issue.id, labelId, }; }