linear_getInitiativeProjects
Retrieve all projects linked to a specific initiative in Linear, including archived projects if specified, using the initiative ID for precise filtering.
Instructions
Get all projects associated with an initiative
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| includeArchived | No | Include archived projects in the results | |
| initiativeId | Yes | The ID of the initiative |
Implementation Reference
- The handler function that implements the core logic for the linear_getInitiativeProjects tool. It validates the input arguments using a type guard and calls the LinearService to fetch projects associated with the given initiative.export function getInitiativeProjectsHandler(linearService: LinearService) { return async (args: unknown) => { if (!isGetInitiativeProjectsInput(args)) { throw new Error('Invalid input for getInitiativeProjects'); } console.log(`[getInitiativeProjects] Fetching projects for initiative: ${args.initiativeId}`); const projects = await linearService.getInitiativeProjects( args.initiativeId, args.includeArchived, ); console.log(`[getInitiativeProjects] Retrieved ${projects.length} projects`); return projects; }; }
- The MCP tool definition for linear_getInitiativeProjects, specifying the name, description, input schema (requiring initiativeId, optional includeArchived), and output schema (array of project objects).{ name: 'linear_getInitiativeProjects', description: 'Get all projects associated with an initiative', input_schema: { type: 'object', properties: { initiativeId: { type: 'string', description: 'The ID of the initiative', }, includeArchived: { type: 'boolean', description: 'Include archived projects in the results', default: false, }, }, required: ['initiativeId'], }, output_schema: { type: 'array', items: { type: 'object', properties: { id: { type: 'string' }, name: { type: 'string' }, description: { type: 'string' }, state: { type: 'string' }, progress: { type: 'number' }, startDate: { type: 'string' }, targetDate: { type: 'string' }, teams: { type: 'array', items: { type: 'object', properties: { id: { type: 'string' }, name: { type: 'string' }, }, }, }, url: { type: 'string' }, }, }, }, },
- src/tools/handlers/index.ts:97-100 (registration)Registration of the linear_getInitiativeProjects handler within the registerToolHandlers function, mapping the tool name to getInitiativeProjectsHandler(linearService).linear_deleteInitiative: deleteInitiativeHandler(linearService), linear_getInitiativeProjects: getInitiativeProjectsHandler(linearService), linear_addProjectToInitiative: addProjectToInitiativeHandler(linearService), linear_removeProjectFromInitiative: removeProjectFromInitiativeHandler(linearService),
- src/tools/type-guards.ts:844-856 (helper)Type guard function isGetInitiativeProjectsInput used by the handler to validate tool input arguments.export function isGetInitiativeProjectsInput(args: unknown): args is { initiativeId: string; includeArchived?: boolean; } { return ( typeof args === 'object' && args !== null && 'initiativeId' in args && typeof (args as { initiativeId: string }).initiativeId === 'string' && (!('includeArchived' in args) || typeof (args as { includeArchived: boolean }).includeArchived === 'boolean') ); }