linear_getInitiativeById
Retrieve detailed information about a specific Linear initiative using its unique ID, optionally including associated projects for comprehensive insights.
Instructions
Get details of a specific initiative by ID
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| includeProjects | No | Include associated projects in the response | |
| initiativeId | Yes | The ID of the initiative to retrieve |
Implementation Reference
- Core handler function for the linear_getInitiativeById tool. Validates input using isGetInitiativeByIdInput type guard and fetches the initiative via linearService.getInitiativeById.export function getInitiativeByIdHandler(linearService: LinearService) { return async (args: unknown) => { if (!isGetInitiativeByIdInput(args)) { throw new Error('Invalid input for getInitiativeById'); } console.log(`[getInitiativeById] Fetching initiative: ${args.initiativeId}`); const initiative = await linearService.getInitiativeById( args.initiativeId, args.includeProjects, ); console.log(`[getInitiativeById] Retrieved initiative: ${initiative.name}`); return initiative; }; }
- Tool schema definition including input and output schemas for linear_getInitiativeById.{ name: 'linear_getInitiativeById', description: 'Get details of a specific initiative by ID', input_schema: { type: 'object', properties: { initiativeId: { type: 'string', description: 'The ID of the initiative to retrieve', }, includeProjects: { type: 'boolean', description: 'Include associated projects in the response', default: true, }, }, required: ['initiativeId'], }, output_schema: { type: 'object', properties: { id: { type: 'string' }, name: { type: 'string' }, description: { type: 'string' }, content: { type: 'string' }, icon: { type: 'string' }, color: { type: 'string' }, status: { type: 'string' }, targetDate: { type: 'string' }, sortOrder: { type: 'number' }, owner: { type: 'object', properties: { id: { type: 'string' }, name: { type: 'string' }, email: { type: 'string' }, }, }, projects: { type: 'array', items: { type: 'object', properties: { id: { type: 'string' }, name: { type: 'string' }, state: { type: 'string' }, }, }, }, url: { type: 'string' }, }, }, },
- src/tools/handlers/index.ts:64-126 (registration)Registers the getInitiativeByIdHandler as 'linear_getInitiativeById' in the tool handlers map.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:737-751 (helper)Type guard function isGetInitiativeByIdInput used in the handler to validate input arguments.* Type guard for linear_getInitiativeById tool arguments */ export function isGetInitiativeByIdInput(args: unknown): args is { initiativeId: string; includeProjects?: boolean; } { return ( typeof args === 'object' && args !== null && 'initiativeId' in args && typeof (args as { initiativeId: string }).initiativeId === 'string' && (!('includeProjects' in args) || typeof (args as { includeProjects: boolean }).includeProjects === 'boolean') ); }