Skip to main content
Glama
Dsazz

JIRA MCP Server

jira_get_sprints

Retrieve sprints from a JIRA board with filtering by state (future, active, or closed) to track project progress and manage agile workflows.

Instructions

Get all sprints for a specific JIRA board with filtering by state

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
boardIdYes
startAtNo
maxResultsNo
stateNo

Implementation Reference

  • GetSprintsHandler: Core tool handler executing validation, business logic via use case, error enhancement, and output formatting.
    export class GetSprintsHandler extends BaseToolHandler<
      GetSprintsParams,
      string
    > {
      private sprintListFormatter: SprintListFormatter;
    
      /**
       * Create a new GetSprintsHandler with use case and validator
       *
       * @param getSprintsUseCase - Use case for retrieving sprints
       * @param sprintValidator - Validator for sprint parameters
       */
      constructor(
        private readonly getSprintsUseCase: GetSprintsUseCase,
        private readonly sprintValidator: SprintValidator,
      ) {
        super("JIRA", "Get Sprints");
        this.sprintListFormatter = new SprintListFormatter();
      }
    
      /**
       * Execute the handler logic
       * Retrieves JIRA sprints with optional filtering and formatting
       *
       * @param params - Parameters for sprint retrieval
       */
      protected async execute(params: GetSprintsParams): Promise<string> {
        try {
          // Step 1: Validate parameters
          const validatedParams =
            this.sprintValidator.validateGetSprintsParams(params);
          this.logger.info(
            `Getting JIRA sprints for board: ${validatedParams.boardId}`,
          );
    
          // Step 2: Get sprints using use case
          this.logger.debug("Retrieving sprints with params:", {
            boardId: validatedParams.boardId,
            hasState: !!validatedParams.state,
            maxResults: validatedParams.maxResults,
          });
    
          const sprints = await this.getSprintsUseCase.execute(validatedParams);
    
          // Step 3: Format and return success response
          this.logger.info(`Successfully retrieved ${sprints.length} sprints`);
          return this.sprintListFormatter.format({
            sprints,
            boardId: validatedParams.boardId,
            appliedFilters: {
              state: validatedParams.state,
              boardId: validatedParams.boardId,
            },
          });
        } catch (error) {
          this.logger.error(`Failed to get JIRA sprints: ${error}`);
          throw this.enhanceError(error, params);
        }
      }
    
      /**
       * Enhance error messages for better user guidance
       */
      private enhanceError(error: unknown, params?: GetSprintsParams): Error {
        const boardContext = params?.boardId ? ` for board ${params.boardId}` : "";
    
        if (error instanceof JiraNotFoundError) {
          return new Error(
            `❌ **No Sprints Found**\n\nNo sprints found${boardContext}.\n\n**Solutions:**\n- Verify the board ID is correct\n- Check if the board has any sprints created\n- Try removing state filters to see all sprints\n- Use \`jira_get_boards\` to find valid board IDs\n\n**Example:** \`jira_get_sprints boardId=123\``,
          );
        }
    
        if (error instanceof JiraPermissionError) {
          return new Error(
            `❌ **Permission Denied**\n\nYou don't have permission to view sprints${boardContext}.\n\n**Solutions:**\n- Check your JIRA permissions\n- Contact your JIRA administrator\n- Verify you have access to the board\n- Use \`jira_get_boards\` to see accessible boards\n\n**Required Permissions:** Browse Projects`,
          );
        }
    
        if (error instanceof JiraApiError) {
          return new Error(
            `❌ **JIRA API Error**\n\n${error.message}\n\n**Solutions:**\n- Verify the board ID is valid\n- Check your filter parameters\n- Try with a different board\n- Ensure the board supports sprints (Scrum boards)\n\n**Example:** \`jira_get_sprints boardId=123 state="active"\``,
          );
        }
    
        if (error instanceof Error) {
          return new Error(
            `❌ **Sprint Retrieval Failed**\n\n${error.message}${boardContext}\n\n**Solutions:**\n- Check your parameters are valid\n- Try a simpler query first\n- Verify your JIRA connection\n\n**Example:** \`jira_get_sprints boardId=123\``,
          );
        }
    
        return new Error(
          `❌ **Unknown Error**\n\nAn unknown error occurred during sprint retrieval${boardContext}.\n\nPlease check your parameters and try again.`,
        );
      }
    }
  • Zod schema defining the input parameters for the jira_get_sprints tool.
    export const getSprintsParamsSchema = z.object({
      boardId: z.number().int().min(1, "Board ID must be a positive integer"),
    
      // Pagination
      startAt: z.number().int().min(0).optional().default(0),
      maxResults: z.number().int().min(1).max(50).optional().default(50),
    
      // Filtering options
      state: z.nativeEnum(SprintState).optional(),
    });
  • Factory creating the GetSprintsHandler instance and wrapping it as the jira_get_sprints tool handler.
    function createSprintHandlers(dependencies: JiraDependencies) {
      const getSprintsHandler = new GetSprintsHandler(
        dependencies.getSprintsUseCase,
        dependencies.sprintValidator,
      );
    
      return {
        jira_get_sprints: {
          handle: async (args: unknown) => getSprintsHandler.handle(args),
        },
      };
    }
  • Configuration defining tool metadata, schema reference, and handler binding for registration.
    export function createSprintToolsConfig(tools: {
      jira_get_sprints: ToolHandler;
    }): ToolConfig[] {
      return [
        {
          name: "jira_get_sprints",
          description: "Get all sprints for a specific JIRA board with filtering by state",
          params: getSprintsParamsSchema.shape,
          handler: tools.jira_get_sprints.handle.bind(tools.jira_get_sprints),
        },
      ];
    } 
  • Tool registry including the sprint tools config group, leading to MCP server.tool() registration.
      groupName: "sprints",
      configs: createSprintToolsConfig({
        jira_get_sprints: tools.jira_get_sprints,
      }),
    },
  • Repository method performing the actual JIRA API call to retrieve sprints for a board.
    async getSprints(
      boardId: number,
      options?: GetSprintsOptions,
    ): Promise<Sprint[]> {
      this.logger.debug(`Getting sprints for board: ${boardId}`, {
        prefix: "JIRA:SprintRepository",
      });
    
      const queryParams: Record<string, string | number | undefined> = {};
    
      if (options?.startAt) {
        queryParams.startAt = options.startAt;
      }
    
      if (options?.maxResults) {
        queryParams.maxResults = options.maxResults;
      }
    
      if (options?.state) {
        queryParams.state = options.state;
      }
    
      const response = await this.httpClient.sendRequest<{ values: Sprint[] }>({
        endpoint: `board/${boardId}/sprint`,
        method: "GET",
        queryParams,
      });
    
      return response.values;
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full burden. It mentions filtering by state, which is useful, but fails to disclose critical behaviors: pagination details (implied by startAt/maxResults but not explained), whether it returns partial/full sprint data, rate limits, authentication needs, or error conditions. For a read operation with 4 parameters, this is insufficient.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that front-loads the core purpose. Every word earns its place—no redundancy or fluff. It's appropriately sized for a straightforward retrieval tool.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given 4 parameters with 0% schema coverage, no annotations, and no output schema, the description is incomplete. It doesn't explain return values (sprint structure), pagination behavior, error handling, or dependencies. For a tool with filtering and pagination, more context is needed to use it effectively.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate. It mentions filtering by state (mapping to the 'state' parameter) and implies board targeting (mapping to 'boardId'), but doesn't explain the other two parameters (startAt, maxResults) or provide format/constraint details. It adds some meaning but leaves significant gaps.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb 'Get' and resource 'all sprints for a specific JIRA board', which is specific and actionable. It distinguishes from siblings like 'jira_get_boards' by focusing on sprints rather than boards, but doesn't explicitly differentiate from other sprint-related tools (none exist in the sibling list).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., needing board access), exclusions, or relationships to sibling tools like 'jira_get_boards' (which might be needed first to obtain board IDs). Usage context is implied but not explicit.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

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/Dsazz/mcp-jira'

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