Skip to main content
Glama

linear_getIssues

Retrieve recent issues from Linear project management to track tasks and monitor progress. Specify limit to control results.

Instructions

Get a list of recent issues from Linear

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNoMaximum number of issues to return (default: 10)

Implementation Reference

  • The main handler function for the linear_getIssues tool. Validates input using type guard and delegates to LinearService.getIssues.
    export function handleGetIssues(linearService: LinearService) {
      return async (args: unknown) => {
        try {
          if (!isGetIssuesArgs(args)) {
            throw new Error('Invalid arguments for getIssues');
          }
    
          return await linearService.getIssues(args.limit);
        } catch (error) {
          logError('Error getting issues', error);
          throw error;
        }
      };
    }
  • Core service method that queries the Linear GraphQL API for recent issues, resolves relationships (team, assignee, etc.), and formats the output matching the tool schema.
    async getIssues(limit = 25) {
      const issues = await this.client.issues({ first: limit });
      return Promise.all(
        issues.nodes.map(async (issue) => {
          // For relations, we need to fetch the objects
          const teamData = issue.team ? await issue.team : null;
          const assigneeData = issue.assignee ? await issue.assignee : null;
          const projectData = issue.project ? await issue.project : null;
          const cycleData = issue.cycle ? await issue.cycle : null;
          const parentData = issue.parent ? await issue.parent : null;
    
          // Get labels
          const labels = await issue.labels();
          const labelsList = labels.nodes.map((label) => ({
            id: label.id,
            name: label.name,
            color: label.color,
          }));
    
          return {
            id: issue.id,
            title: issue.title,
            description: issue.description,
            state: issue.state,
            priority: issue.priority,
            estimate: issue.estimate,
            dueDate: issue.dueDate,
            team: teamData
              ? {
                  id: teamData.id,
                  name: teamData.name,
                }
              : null,
            assignee: assigneeData
              ? {
                  id: assigneeData.id,
                  name: assigneeData.name,
                }
              : null,
            project: projectData
              ? {
                  id: projectData.id,
                  name: projectData.name,
                }
              : null,
            cycle: cycleData
              ? {
                  id: cycleData.id,
                  name: cycleData.name,
                }
              : null,
            parent: parentData
              ? {
                  id: parentData.id,
                  title: parentData.title,
                }
              : null,
            labels: labelsList,
            sortOrder: issue.sortOrder,
            createdAt: issue.createdAt,
            updatedAt: issue.updatedAt,
            url: issue.url,
          };
        }),
      );
    }
  • Input/output schema definition for the linear_getIssues tool.
    export const getIssuesToolDefinition: MCPToolDefinition = {
      name: 'linear_getIssues',
      description: 'Get a list of recent issues from Linear',
      input_schema: {
        type: 'object',
        properties: {
          limit: {
            type: 'number',
            description: 'Maximum number of issues to return (default: 10)',
          },
        },
      },
      output_schema: {
        type: 'array',
        items: {
          type: 'object',
          properties: {
            id: { type: 'string' },
            identifier: { type: 'string' },
            title: { type: 'string' },
            description: { type: 'string' },
            state: { type: 'string' },
            priority: { type: 'number' },
            estimate: { type: 'number' },
            dueDate: { type: 'string' },
            team: { type: 'object' },
            assignee: { type: 'object' },
            project: { type: 'object' },
            cycle: { type: 'object' },
            parent: { type: 'object' },
            labels: {
              type: 'array',
              items: {
                type: 'object',
                properties: {
                  id: { type: 'string' },
                  name: { type: 'string' },
                  color: { type: 'string' },
                },
              },
            },
            sortOrder: { type: 'number' },
            createdAt: { type: 'string' },
            updatedAt: { type: 'string' },
            url: { type: 'string' },
          },
        },
      },
    };
  • Registration of all tool handlers, including linear_getIssues mapped to handleGetIssues.
    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/index.ts:44-56 (registration)
    Top-level MCP server registration where tool handlers are dynamically invoked based on request name.
      handleRequest: async (req: { name: string; args: unknown }) => {
        const handlers = registerToolHandlers(linearService);
        const toolName = req.name;
    
        if (toolName in handlers) {
          // Use a type assertion here since we know the tool name is valid
          const handler = handlers[toolName as keyof typeof handlers];
          return await handler(req.args);
        } else {
          throw new Error(`Unknown tool: ${toolName}`);
        }
      },
    });

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/tacticlaunch/mcp-linear'

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