Skip to main content
Glama

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

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 }; }

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