list_issues_from_sprint
Retrieve all issues assigned to a specific sprint on a Jira board. Uses board and sprint IDs to return tasks, bugs, and stories.
Instructions
List issues from a sprint
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sprintId | Yes | The ID of the sprint | |
| boardId | Yes | The ID of the board | |
| maxResults | No | The maximum number of results to return, (default: 5, max: 100) | |
| startAt | No | The starting index of the returned boards | |
| expand | No | Use this parameter to include additional information in the response. This parameter accepts a comma-separated list. Expand options include: `schema` and `names`. Comma separated list of options. |
Implementation Reference
- The handler function that executes the 'list_issues_from_sprint' tool logic. It constructs a Jira Agile API URL, fetches issues from a sprint, validates the response, and returns the result.
export async function listIssuesFromSprint(input: ListIssuesFromSprintInput) { const url = new URL( `/rest/agile/1.0/board/${input.boardId}/sprint/${input.sprintId}/issue`, env.JIRA_BASE_URL, ); if (input.expand) url.searchParams.set("expand", input.expand); if (input.startAt) url.searchParams.set("startAt", input.startAt.toString()); if (input.maxResults) url.searchParams.set("maxResults", input.maxResults.toString()); const json = await $jiraJson(url.toString()); if (json.isErr()) return err(json.error); const result = listIssuesFromSprintSchema.safeParse(json.value); if (!result.success) { return err(new Error("Invalid response from Jira")); } return ok(result.data); } - Input schema for the tool, defining sprintId (required), boardId (required), and optional parameters maxResults, startAt, expand.
export const listIssuesFromSprintInputSchema = z.object({ sprintId: z.string().describe("The ID of the sprint"), boardId: z.string().describe("The ID of the board"), maxResults: z .number() .optional() .describe( "The maximum number of results to return, (default: 5, max: 100)", ), startAt: z .number() .optional() .describe("The starting index of the returned boards"), expand: z .string() .optional() .describe( "Use this parameter to include additional information in the response. This parameter accepts a comma-separated list. Expand options include: `schema` and `names`. Comma separated list of options.", ), }); - Response schema for parsing the Jira API response, containing pagination fields and an array of issues conforming to issueSchema.
const listIssuesFromSprintSchema = z.object({ maxResults: z.number().optional(), startAt: z.number().optional(), expand: z.string().optional(), total: z.number().optional(), issues: z.array(issueSchema), }); - src/tools/list-issues-from-sprint.ts:40-48 (registration)Tool definition object for registration, with name 'list_issues_from_sprint', description, and JSON Schema input.
export const LIST_ISSUES_FROM_SPRINT_TOOL: Tool = { name: "list_issues_from_sprint", description: "List issues from a sprint", inputSchema: zodToJsonSchema( listIssuesFromSprintInputSchema, ) as Tool["inputSchema"], }; export type ListIssuesFromSprintInput = z.output< - src/app.ts:61-85 (registration)Registration in the MCP server's CallToolRequestSchema handler: routes the 'list_issues_from_sprint' tool call to validation and execution.
if (name === LIST_ISSUES_FROM_SPRINT_TOOL.name) { const input = listIssuesFromSprintInputSchema.safeParse(args); if (!input.success) { return { isError: true, content: [{ type: "text", text: "Invalid input" }], }; } const result = await listIssuesFromSprint(input.data); if (result.isErr()) { console.error(result.error.message); return { isError: true, content: [{ type: "text", text: "An error occurred" }], }; } return { content: [ { type: "text", text: JSON.stringify(result.value, null, 2) }, ], };