list_project_issues
Retrieve Jira issues for a specific project with optional filtering and pagination controls to manage and analyze project tasks effectively.
Instructions
List issues for a project with optional JQL tail filters.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| projectKey | Yes | Project key (e.g., PROJ) | |
| jqlTail | No | Optional extra JQL, e.g., AND status="In Progress" | |
| startAt | No | Pagination start index (default 0) | |
| maxResults | No | Page size (1-100, default 50) |
Implementation Reference
- src/server.ts:288-305 (handler)Handler function for the 'list_project_issues' tool. Constructs a JQL query for issues in the specified project (with optional filters), performs a POST to Jira's search API, processes the results, and returns formatted content and structured data.async (args: { projectKey: string; jqlTail?: string; startAt?: number; maxResults?: number }) => { const jql = `project=${args.projectKey}${args.jqlTail ? " " + args.jqlTail : ""}`; return await (async () => { try { const body: any = { jql, startAt: args.startAt ?? 0, maxResults: args.maxResults ?? 50, fields: ["key","summary","status","assignee","priority","issuetype","updated"] }; const response = await fetch(`${JIRA_URL}/rest/api/3/search`, { method: "POST", headers: getJiraHeaders(), body: JSON.stringify(body) }); if (!response.ok) { const errorText = await response.text(); return { content: [{ type: "text", text: `Failed to list project issues: ${response.status} ${response.statusText}\n${errorText}` }], isError: true }; } const data = await response.json() as any; const items = (data.issues || []).map((it: any) => ({ key: it.key, summary: it.fields?.summary, status: it.fields?.status?.name, assignee: it.fields?.assignee?.displayName, priority: it.fields?.priority?.name, type: it.fields?.issuetype?.name, updated: it.fields?.updated, url: `${JIRA_URL}/browse/${it.key}` })); return { content: [{ type: "text", text: `Found ${data.total ?? items.length} issues in ${args.projectKey} (showing ${items.length}).` }], structuredContent: { total: data.total ?? items.length, startAt: data.startAt ?? 0, maxResults: data.maxResults ?? items.length, issues: items, projectKey: args.projectKey, raw: data } }; } catch (error) { return { content: [{ type: "text", text: `Error listing issues for ${args.projectKey}: ${error instanceof Error ? error.message : String(error)}` }], isError: true }; } })(); }
- src/server.ts:278-286 (schema)Input schema definition for the 'list_project_issues' tool, specifying parameters like projectKey, optional JQL tail, and pagination options using Zod validators.{ title: "List Issues in Project", description: "List issues for a project with optional JQL tail filters.", inputSchema: { projectKey: z.string().describe("Project key (e.g., PROJ)"), jqlTail: z.string().optional().describe("Optional extra JQL, e.g., AND status=\"In Progress\""), startAt: z.number().int().min(0).optional().describe("Pagination start index (default 0)"), maxResults: z.number().int().min(1).max(100).optional().describe("Page size (1-100, default 50)"), },
- src/server.ts:276-306 (registration)Registration of the 'list_project_issues' MCP tool on the server instance using mcp.registerTool, including title, description, input schema, and handler function.mcp.registerTool( "list_project_issues", { title: "List Issues in Project", description: "List issues for a project with optional JQL tail filters.", inputSchema: { projectKey: z.string().describe("Project key (e.g., PROJ)"), jqlTail: z.string().optional().describe("Optional extra JQL, e.g., AND status=\"In Progress\""), startAt: z.number().int().min(0).optional().describe("Pagination start index (default 0)"), maxResults: z.number().int().min(1).max(100).optional().describe("Page size (1-100, default 50)"), }, }, async (args: { projectKey: string; jqlTail?: string; startAt?: number; maxResults?: number }) => { const jql = `project=${args.projectKey}${args.jqlTail ? " " + args.jqlTail : ""}`; return await (async () => { try { const body: any = { jql, startAt: args.startAt ?? 0, maxResults: args.maxResults ?? 50, fields: ["key","summary","status","assignee","priority","issuetype","updated"] }; const response = await fetch(`${JIRA_URL}/rest/api/3/search`, { method: "POST", headers: getJiraHeaders(), body: JSON.stringify(body) }); if (!response.ok) { const errorText = await response.text(); return { content: [{ type: "text", text: `Failed to list project issues: ${response.status} ${response.statusText}\n${errorText}` }], isError: true }; } const data = await response.json() as any; const items = (data.issues || []).map((it: any) => ({ key: it.key, summary: it.fields?.summary, status: it.fields?.status?.name, assignee: it.fields?.assignee?.displayName, priority: it.fields?.priority?.name, type: it.fields?.issuetype?.name, updated: it.fields?.updated, url: `${JIRA_URL}/browse/${it.key}` })); return { content: [{ type: "text", text: `Found ${data.total ?? items.length} issues in ${args.projectKey} (showing ${items.length}).` }], structuredContent: { total: data.total ?? items.length, startAt: data.startAt ?? 0, maxResults: data.maxResults ?? items.length, issues: items, projectKey: args.projectKey, raw: data } }; } catch (error) { return { content: [{ type: "text", text: `Error listing issues for ${args.projectKey}: ${error instanceof Error ? error.message : String(error)}` }], isError: true }; } })(); } );