Skip to main content
Glama
kunwarVivek

mcp-github-project-manager

list_issues

Retrieve GitHub issues by filtering status, assignee, labels, milestone, and sorting options to manage project tasks effectively.

Instructions

List GitHub issues

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
statusYes
milestoneNo
labelsNo
assigneeNo
sortNo
directionNo
limitNo

Implementation Reference

  • Core handler function implementing the list_issues tool logic. Fetches issues from repository, applies filters for status, milestone, labels, assignee; sorts by created/updated/comments; limits results.
    async listIssues(options: {
      status?: string;
      milestone?: string;
      labels?: string[];
      assignee?: string;
      sort?: string;
      direction?: string;
      limit?: number;
    } = {}): Promise<Issue[]> {
      try {
        // Set default values
        const {
          status = 'open',
          milestone,
          labels = [],
          assignee,
          sort = 'created',
          direction = 'desc',
          limit = 30
        } = options;
    
        let issues: Issue[];
    
        if (milestone) {
          // If milestone is specified, get issues for that milestone
          issues = await this.issueRepo.findByMilestone(milestone);
        } else {
          // Otherwise get all issues
          issues = await this.issueRepo.findAll();
        }
    
        // Filter by status
        if (status !== 'all') {
          const resourceStatus = status === 'open' ? ResourceStatus.ACTIVE : ResourceStatus.CLOSED;
          issues = issues.filter(issue => issue.status === resourceStatus);
        }
    
        // Filter by labels if provided
        if (labels.length > 0) {
          issues = issues.filter(issue =>
            labels.every(label => issue.labels.includes(label))
          );
        }
    
        // Filter by assignee if provided
        if (assignee) {
          issues = issues.filter(issue =>
            issue.assignees.includes(assignee)
          );
        }
    
        // Sort the issues
        issues.sort((a, b) => {
          let valueA, valueB;
    
          switch(sort) {
            case 'updated':
              valueA = a.updatedAt;
              valueB = b.updatedAt;
              break;
            case 'comments':
              // Since we don't have comment count in our model, default to created
            case 'created':
            default:
              valueA = a.createdAt;
              valueB = b.createdAt;
          }
    
          const comparison = valueA.localeCompare(valueB);
          return direction === 'desc' ? -comparison : comparison;
        });
    
        // Apply limit
        return issues.slice(0, limit);
      } catch (error) {
        throw this.mapErrorToMCPError(error);
      }
    }
  • Tool definition including input schema, description, and examples for list_issues. References listIssuesSchema defined earlier (lines 145-156).
    export const listIssuesTool: ToolDefinition<ListIssuesArgs> = {
      name: "list_issues",
      description: "List GitHub issues",
      schema: listIssuesSchema as unknown as ToolSchema<ListIssuesArgs>,
      examples: [
        {
          name: "List open issues for milestone",
          description: "List open issues assigned to a specific milestone",
          args: {
            status: "open",
            milestone: "1",
            sort: "updated",
            direction: "desc",
            limit: 10
          }
        }
      ]
    };
  • Registration of the listIssuesTool (along with other issue tools) in the central ToolRegistry singleton during initialization.
    this.registerTool(createIssueTool);
    this.registerTool(listIssuesTool);
    this.registerTool(getIssueTool);
    this.registerTool(updateIssueTool);
  • MCP tool dispatch handler in main server that routes list_issues calls to ProjectManagementService.listIssues
    case "list_issues":
      return await this.service.listIssues(args);
  • Repository helper method findAll() that executes GraphQL query to fetch issues from GitHub API, used by service.listIssues.
    async findAll(): Promise<Issue[]> {
      const query = `
        query($owner: String!, $repo: String!) {
          repository(owner: $owner, name: $repo) {
            issues(first: 100) {
              nodes {
                id
                number
                title
                body
                state
                createdAt
                updatedAt
                assignees(first: 100) {
                  nodes {
                    login
                  }
                }
                labels(first: 100) {
                  nodes {
                    name
                  }
                }
                milestone {
                  id
                }
              }
            }
          }
        }
      `;
    
      const response = await this.graphql<ListIssuesResponse>(query, {
        owner: this.owner,
        repo: this.repo,
      });
    
      return response.repository.issues.nodes.map(issue =>
        this.mapGitHubIssueToIssue(issue)
      );
    }
Install Server

Other Tools

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/kunwarVivek/mcp-github-project-manager'

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