Skip to main content
Glama

linear_get_projects

Retrieve and filter project data from Linear's issue tracking system to monitor progress, organize work, and manage team initiatives.

Instructions

Get projects in the organization

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
includeArchivedNoInclude archived projects
limitNoMaximum number of projects to return (default: 50)
statusNoFilter by project status (e.g., 'completed', 'in progress')
teamIdNoFilter projects by team ID

Implementation Reference

  • The main handler function that executes the tool logic: fetches Linear projects optionally filtered by team, status, etc., and returns JSON.
    export const linearGetProjectsHandler: ToolHandler = async args => { const params = args as { teamId?: string; includeArchived?: boolean; limit?: number; status?: string; }; try { // Set up query parameters const queryParams: { first: number; includeArchived: boolean; } = { first: params.limit || 50, includeArchived: params.includeArchived || false, }; // Fetch projects using the Linear API let projectsResponse; if (params.teamId) { // If teamId is provided, fetch projects for that team const team = await linearClient.team(params.teamId); if (!team) { return { content: [ { type: 'text', text: `Error: Team with ID ${params.teamId} not found`, }, ], isError: true, }; } projectsResponse = await team.projects(queryParams); } else { // Otherwise, fetch all projects projectsResponse = await linearClient.projects(queryParams); } if (!projectsResponse) { return { content: [ { type: 'text', text: 'Error: Failed to fetch projects', }, ], isError: true, }; } // Filter by status if provided let projectNodes = projectsResponse.nodes; if (params.status && projectNodes.length > 0) { const statusFilter = params.status.toLowerCase(); const filteredProjects = []; for (const project of projectNodes) { const projectStatus = await project.status; if (projectStatus) { const statusName = await projectStatus.name; if (statusName && statusName.toLowerCase() === statusFilter) { filteredProjects.push(project); } } } projectNodes = filteredProjects; } // Extract project data const projects = await Promise.all( projectNodes.map(async project => { const status = await project.status; // Teams is a connection, fetch the first team (if any) const teamsConnection = await project.teams({ first: 1 }); const team = teamsConnection?.nodes?.[0]; return { id: project.id, name: project.name, description: project.description, status: status ? await status.name : null, teamId: team ? await team.id : null, teamName: team ? await team.name : null, startDate: project.startDate, targetDate: project.targetDate, url: project.url, progress: project.progress, priority: project.priority, color: project.color, icon: project.icon, createdAt: project.createdAt, updatedAt: project.updatedAt, }; }) ); return { content: [ { type: 'text', text: JSON.stringify(projects), }, ], }; } catch (error) { const errorMessage = error instanceof Error ? error.message : typeof error === 'string' ? error : 'Unknown error occurred'; return { content: [ { type: 'text', text: `Error: ${errorMessage}`, }, ], isError: true, }; } };
  • Input schema defining parameters for the linear_get_projects tool: teamId, includeArchived, limit, status.
    inputSchema: { type: 'object', properties: { teamId: { type: 'string', description: 'Filter projects by team ID', }, includeArchived: { type: 'boolean', description: 'Include archived projects', }, limit: { type: 'number', description: 'Maximum number of projects to return (default: 50)', }, status: { type: 'string', description: "Filter by project status (e.g., 'completed', 'in progress')", }, }, },
  • Registration of the linear_get_projects tool using registerTool, including name, description, schema, and handler reference.
    export const linearGetProjectsTool = registerTool( { name: 'linear_get_projects', description: 'Get projects in the organization', inputSchema: { type: 'object', properties: { teamId: { type: 'string', description: 'Filter projects by team ID', }, includeArchived: { type: 'boolean', description: 'Include archived projects', }, limit: { type: 'number', description: 'Maximum number of projects to return (default: 50)', }, status: { type: 'string', description: "Filter by project status (e.g., 'completed', 'in progress')", }, }, }, }, linearGetProjectsHandler );

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/magarcia/mcp-server-linearapp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server