linear_addIssueLabel
Add a specified label to a Linear issue using its issue and label IDs, enabling efficient issue categorization and management within the Linear project system.
Instructions
Add a label to an issue in Linear
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| issueId | Yes | ID or identifier of the issue to add the label to (e.g., ABC-123) | |
| labelId | Yes | ID of the label to add to the issue |
Implementation Reference
- The core handler function for the linear_addIssueLabel tool. Validates arguments using type guard and calls the Linear service to add a label to an issue.export function handleAddIssueLabel(linearService: LinearService) { return async (args: unknown) => { try { if (!isAddIssueLabelArgs(args)) { throw new Error('Invalid arguments for addIssueLabel'); } return await linearService.addIssueLabel(args.issueId, args.labelId); } catch (error) { logError('Error adding label to issue', error); throw error; } }; }
- MCP tool schema definition for linear_addIssueLabel, including input and output schemas.export const addIssueLabelToolDefinition: MCPToolDefinition = { name: 'linear_addIssueLabel', description: 'Add a label to an issue in Linear', input_schema: { type: 'object', properties: { issueId: { type: 'string', description: 'ID or identifier of the issue to add the label to (e.g., ABC-123)', }, labelId: { type: 'string', description: 'ID of the label to add to the issue', }, }, required: ['issueId', 'labelId'], }, output_schema: { type: 'object', properties: { success: { type: 'boolean' }, issueId: { type: 'string' }, labelId: { type: 'string' }, }, }, };
- src/tools/handlers/index.ts:64-126 (registration)The tool is registered in the registerToolHandlers function by mapping 'linear_addIssueLabel' to the handleAddIssueLabel handler.export function registerToolHandlers(linearService: LinearService) { return { // User tools linear_getViewer: handleGetViewer(linearService), linear_getOrganization: handleGetOrganization(linearService), linear_getUsers: handleGetUsers(linearService), linear_getLabels: handleGetLabels(linearService), // Team tools linear_getTeams: handleGetTeams(linearService), linear_getWorkflowStates: handleGetWorkflowStates(linearService), // Project tools linear_getProjects: handleGetProjects(linearService), linear_createProject: handleCreateProject(linearService), // Project Management tools linear_updateProject: handleUpdateProject(linearService), linear_addIssueToProject: handleAddIssueToProject(linearService), linear_getProjectIssues: handleGetProjectIssues(linearService), // Cycle Management tools linear_getCycles: handleGetCycles(linearService), linear_getActiveCycle: handleGetActiveCycle(linearService), linear_addIssueToCycle: handleAddIssueToCycle(linearService), // Initiative Management tools linear_getInitiatives: getInitiativesHandler(linearService), linear_getInitiativeById: getInitiativeByIdHandler(linearService), linear_createInitiative: createInitiativeHandler(linearService), linear_updateInitiative: updateInitiativeHandler(linearService), linear_archiveInitiative: archiveInitiativeHandler(linearService), linear_unarchiveInitiative: unarchiveInitiativeHandler(linearService), linear_deleteInitiative: deleteInitiativeHandler(linearService), linear_getInitiativeProjects: getInitiativeProjectsHandler(linearService), linear_addProjectToInitiative: addProjectToInitiativeHandler(linearService), linear_removeProjectFromInitiative: removeProjectFromInitiativeHandler(linearService), // Issue tools linear_getIssues: handleGetIssues(linearService), linear_getIssueById: handleGetIssueById(linearService), linear_searchIssues: handleSearchIssues(linearService), linear_createIssue: handleCreateIssue(linearService), linear_updateIssue: handleUpdateIssue(linearService), linear_createComment: handleCreateComment(linearService), linear_addIssueLabel: handleAddIssueLabel(linearService), linear_removeIssueLabel: handleRemoveIssueLabel(linearService), // New Issue Management tools linear_assignIssue: handleAssignIssue(linearService), linear_subscribeToIssue: handleSubscribeToIssue(linearService), linear_convertIssueToSubtask: handleConvertIssueToSubtask(linearService), linear_createIssueRelation: handleCreateIssueRelation(linearService), linear_archiveIssue: handleArchiveIssue(linearService), linear_setIssuePriority: handleSetIssuePriority(linearService), linear_transferIssue: handleTransferIssue(linearService), linear_duplicateIssue: handleDuplicateIssue(linearService), linear_getIssueHistory: handleGetIssueHistory(linearService), // Comment Management tools linear_getComments: handleGetComments(linearService), }; }
- src/tools/type-guards.ts:226-238 (helper)Type guard function used in the handler to validate input arguments for the linear_addIssueLabel tool.export function isAddIssueLabelArgs(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' ); }