Skip to main content
Glama

Get Sprint Tasks

get_sprint_tasks

Retrieve your assigned tasks or all team tasks for the current or next sprint week from Jira, automatically matching date-based sprint labels.

Instructions

Retrieve Sprint tasks for the current week or next week. Sprint tasks are tagged with labels in the format MonDD-DD (e.g., Dec15-19 for December 15-19).

Two query modes:

  • my_tasks: Retrieve tasks assigned to the current authenticated user for the specified week

  • team_tasks: Retrieve all tasks for the team for the specified week (regardless of assignee)

The tool automatically calculates the Monday-Friday date range and matches against the corresponding sprint label.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
weekYesWhich week to retrieve sprint tasks for
scopeYesScope of tasks: "my_tasks" for current user only, "team_tasks" for all team tasks

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
errorNo
tasksNo
weekRangeNoThe date range for the sprint week
sprintLabelNoThe sprint label used for the query (e.g., "Dec15-19")

Implementation Reference

  • The core handler function implementing get_sprint_tasks logic: calculates sprint label, builds JQL query filtering by label and optionally assignee, searches Jira issues, maps to SprintTask format, and returns structured result with week range.
    export async function getSprintTasks(
      week: 'this_week' | 'next_week',
      scope: 'my_tasks' | 'team_tasks',
      currentUser?: string
    ): Promise<SprintTasksResult> {
      const weekOffset = week === 'this_week' ? 0 : 1;
      const { label, mondayDate, fridayDate } = calculateSprintLabel(weekOffset);
    
      // Build JQL query to find issues with the sprint label
      let jql = `labels = "${label}"`;
    
      // Filter by assignee if scope is 'my_tasks'
      if (scope === 'my_tasks') {
        if (!currentUser) {
          throw new Error('currentUser is required for my_tasks scope');
        }
        jql += ` AND assignee = ${currentUser}`;
      }
    
      // Order by priority then status
      jql += ' ORDER BY priority DESC, status ASC';
    
      // Search for issues with the matching label
      const params = new URLSearchParams({
        jql,
        maxResults: '100',
      });
      ['summary', 'status', 'priority', 'assignee', 'updated'].forEach(f => params.append('fields', f));
    
      const response = await jiraFetch<{
        issues: Array<{
          key: string;
          id: string;
          fields: {
            summary: string;
            status: { name: string };
            priority: { name: string };
            assignee?: { displayName: string; accountId: string };
            updated: string;
          };
        }>;
      }>(`/search/jql?${params.toString()}`);
    
      const tasks: SprintTask[] = response.issues.map((issue) => ({
        key: issue.key,
        summary: issue.fields.summary,
        status: issue.fields.status.name,
        priority: issue.fields.priority?.name || 'None',
        assignee: issue.fields.assignee?.displayName,
        updated: issue.fields.updated,
      }));
    
      return {
        sprintLabel: label,
        weekRange: {
          monday: mondayDate.toISOString().split('T')[0],
          friday: fridayDate.toISOString().split('T')[0],
        },
        tasks,
      };
    }
  • src/index.ts:681-738 (registration)
    MCP tool registration for 'get_sprint_tasks', including title, description, input/output schemas using Zod, and async handler that invokes the jira-client getSprintTasks function with CURRENT_USER.
    server.registerTool(
      'get_sprint_tasks',
      {
        title: 'Get Sprint Tasks',
        description: `Retrieve Sprint tasks for the current week or next week. Sprint tasks are tagged with labels in the format MonDD-DD (e.g., Dec15-19 for December 15-19).
    
    Two query modes:
    - my_tasks: Retrieve tasks assigned to the current authenticated user for the specified week
    - team_tasks: Retrieve all tasks for the team for the specified week (regardless of assignee)
    
    The tool automatically calculates the Monday-Friday date range and matches against the corresponding sprint label.`,
        inputSchema: {
          week: z.enum(['this_week', 'next_week']).describe('Which week to retrieve sprint tasks for'),
          scope: z.enum(['my_tasks', 'team_tasks']).describe('Scope of tasks: "my_tasks" for current user only, "team_tasks" for all team tasks'),
        },
        outputSchema: {
          sprintLabel: z.string().optional().describe('The sprint label used for the query (e.g., "Dec15-19")'),
          weekRange: z.object({
            monday: z.string(),
            friday: z.string(),
          }).optional().describe('The date range for the sprint week'),
          tasks: z.array(z.object({
            key: z.string(),
            summary: z.string(),
            status: z.string(),
            priority: z.string(),
            assignee: z.string().optional(),
            updated: z.string(),
          })).optional(),
          error: z.object({
            message: z.string(),
            statusCode: z.number().optional(),
            details: z.unknown().optional(),
          }).optional(),
        },
      },
      async ({ week, scope }) => {
        try {
          const result = await getSprintTasks(week, scope, CURRENT_USER);
          const output = {
            sprintLabel: result.sprintLabel,
            weekRange: result.weekRange,
            tasks: result.tasks,
          };
          return {
            content: [{ type: 'text', text: JSON.stringify(output, null, 2) }],
            structuredContent: output,
          };
        } catch (error) {
          const output = formatError(error);
          return {
            content: [{ type: 'text', text: JSON.stringify(output, null, 2) }],
            structuredContent: output,
            isError: true,
          };
        }
      }
    );
  • Zod schemas defining input parameters (week, scope enums) and output structure (sprintLabel, weekRange, tasks array, optional error) for the get_sprint_tasks tool.
      {
        title: 'Get Sprint Tasks',
        description: `Retrieve Sprint tasks for the current week or next week. Sprint tasks are tagged with labels in the format MonDD-DD (e.g., Dec15-19 for December 15-19).
    
    Two query modes:
    - my_tasks: Retrieve tasks assigned to the current authenticated user for the specified week
    - team_tasks: Retrieve all tasks for the team for the specified week (regardless of assignee)
    
    The tool automatically calculates the Monday-Friday date range and matches against the corresponding sprint label.`,
        inputSchema: {
          week: z.enum(['this_week', 'next_week']).describe('Which week to retrieve sprint tasks for'),
          scope: z.enum(['my_tasks', 'team_tasks']).describe('Scope of tasks: "my_tasks" for current user only, "team_tasks" for all team tasks'),
        },
        outputSchema: {
          sprintLabel: z.string().optional().describe('The sprint label used for the query (e.g., "Dec15-19")'),
          weekRange: z.object({
            monday: z.string(),
            friday: z.string(),
          }).optional().describe('The date range for the sprint week'),
          tasks: z.array(z.object({
            key: z.string(),
            summary: z.string(),
            status: z.string(),
            priority: z.string(),
            assignee: z.string().optional(),
            updated: z.string(),
          })).optional(),
          error: z.object({
            message: z.string(),
            statusCode: z.number().optional(),
            details: z.unknown().optional(),
          }).optional(),
        },
      },
  • Helper function to calculate sprint label (e.g., 'Dec15-19') and Monday/Friday dates for current or next week, used by getSprintTasks to build JQL query.
    export function calculateSprintLabel(weekOffset: number = 0): {
      label: string;
      mondayDate: Date;
      fridayDate: Date;
    } {
      const now = new Date();
    
      // Find Monday of the current week
      const dayOfWeek = now.getDay(); // 0 = Sunday, 1 = Monday, etc.
      const daysUntilMonday = dayOfWeek === 0 ? -6 : 1 - dayOfWeek; // If Sunday, go back 6 days
    
      const monday = new Date(now);
      monday.setDate(now.getDate() + daysUntilMonday + (weekOffset * 7));
      monday.setHours(0, 0, 0, 0);
    
      const friday = new Date(monday);
      friday.setDate(monday.getDate() + 4);
      friday.setHours(23, 59, 59, 999);
    
      const month = MONTH_ABBR[monday.getMonth()];
      const mondayDay = monday.getDate();
      const fridayDay = friday.getDate();
    
      // Format: MonDD-DD (e.g., Dec15-19)
      // If the week spans two months, still use the Monday's month
      const label = `${month}${mondayDay}-${fridayDay}`;
    
      return { label, mondayDate: monday, fridayDate: friday };
    }
Behavior4/5

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

With no annotations provided, the description carries full burden and does well by explaining the tool automatically calculates Monday-Friday date ranges and matches sprint labels. It clarifies authentication context ('current authenticated user') and scope behavior. Could improve by mentioning output format or pagination.

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?

Perfectly structured with purpose statement, two clear query mode definitions, and behavioral note about automatic date calculation. Every sentence adds essential information with zero waste. Front-loaded with core functionality.

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

Completeness4/5

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

Given 2 parameters with 100% schema coverage and an output schema exists, the description provides excellent context about what the tool does and when to use it. Could slightly improve by mentioning what information is returned in tasks, but output schema likely covers this.

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

Parameters4/5

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

Schema description coverage is 100% with clear enum descriptions, so baseline is 3. The description adds value by explaining the semantic meaning of scope options (my_tasks vs team_tasks) and how week selection works with automatic date calculation, elevating it above baseline.

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

Purpose5/5

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

The description clearly states the verb 'retrieve' and resource 'sprint tasks', specifying they are for 'current week or next week' and tagged with specific label formats. It distinguishes from siblings like get_my_issues or get_team_activity by focusing on sprint-specific tasks with date-based labels.

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

Usage Guidelines5/5

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

Explicitly defines two query modes (my_tasks vs team_tasks) with clear when-to-use guidance: 'my_tasks: Retrieve tasks assigned to the current authenticated user' and 'team_tasks: Retrieve all tasks for the team... regardless of assignee.' Also specifies temporal scope (this_week/next_week).

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

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