Skip to main content
Glama

list_sprints

Retrieve all sprints with a specific status from GitHub Projects V2 using this tool. Ideal for monitoring sprint progress and managing development workflows.

Instructions

List all sprints

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
statusYes

Implementation Reference

  • Core handler logic for listing sprints. Fetches all sprints from repository and filters by status parameter.
    async listSprints(status: string = 'all'): Promise<Sprint[]> { try { const sprints = await this.sprintRepo.findAll(); // Filter by status if needed if (status !== 'all') { let resourceStatus; switch(status) { case 'planned': resourceStatus = ResourceStatus.PLANNED; break; case 'active': resourceStatus = ResourceStatus.ACTIVE; break; case 'completed': resourceStatus = ResourceStatus.COMPLETED; break; default: return sprints; } return sprints.filter(sprint => sprint.status === resourceStatus); } return sprints; } catch (error) { throw this.mapErrorToMCPError(error); } }
  • MCP tool dispatch handler that routes 'list_sprints' calls to the ProjectManagementService.
    case "list_sprints": return await this.service.listSprints(args.status);
  • Tool definition including input schema (status: enum ["planned", "active", "completed", "all"]), description, and examples.
    export const listSprintsTool: ToolDefinition<ListSprintsArgs> = { name: "list_sprints", description: "List all sprints", schema: listSprintsSchema as unknown as ToolSchema<ListSprintsArgs>, examples: [ { name: "List active sprints", description: "List all currently active sprints", args: { status: "active" } } ] };
  • Registers the listSprintsTool in the central tool registry during initialization.
    this.registerTool(listSprintsTool);
  • Low-level repository method that queries GitHub GraphQL API for project iteration fields and maps them to Sprint objects.
    async findAll(options?: { status?: ResourceStatus }): Promise<Sprint[]> { const query = ` query($owner: String!, $repo: String!) { repository(owner: $owner, name: $repo) { projectsV2(first: 1) { nodes { fields(first: 100) { nodes { ... on ProjectV2IterationField { id name configuration { ... on ProjectV2IterationFieldConfiguration { iterations { id title startDate duration } } } } } } } } } } `; const response = await this.graphql<ListIterationFieldsResponse>(query, { owner: this.owner, repo: this.repo, }); if (!response.repository?.projectsV2?.nodes?.[0]?.fields?.nodes) { return []; } const sprints: Sprint[] = []; // Find iteration fields and extract their iterations for (const field of response.repository.projectsV2.nodes[0].fields.nodes) { if (field.configuration?.iterations) { for (const iteration of field.configuration.iterations) { const startDate = new Date(iteration.startDate); const endDate = new Date(startDate); endDate.setDate(endDate.getDate() + iteration.duration * 7); sprints.push({ id: iteration.id, title: iteration.title, description: "Sprint created from GitHub Projects iteration", // Default description startDate: startDate.toISOString(), endDate: endDate.toISOString(), status: this.determineSprintStatus(startDate, endDate), issues: [], // Issues would need separate query createdAt: startDate.toISOString(), updatedAt: new Date().toISOString(), }); } } } if (options?.status) { return sprints.filter(sprint => sprint.status === options.status); } return sprints; }

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