jql_search
Search Jira issues using JQL queries to filter and retrieve specific project data with customizable result fields and pagination.
Instructions
Perform enhanced JQL search in Jira
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| jql | Yes | JQL query string | |
| nextPageToken | No | Token for next page | |
| maxResults | No | Maximum results to fetch | |
| fields | No | List of fields to return for each issue | |
| expand | No | Additional info to include in the response |
Implementation Reference
- index.js:109-151 (handler)Handler for the jql_search tool. Destructures arguments, makes a POST request to Jira's /rest/api/2/search endpoint with the JQL query, handles pagination and fields, returns formatted JSON or error.if (name === "jql_search") { const { jql, nextPageToken, maxResults, fields, expand } = args; try { const response = await fetch(`${JIRA_INSTANCE_URL}/rest/api/2/search`, { method: "POST", headers: { "Content-Type": "application/json", Authorization: `Basic ${Buffer.from(`${JIRA_USER_EMAIL}:${JIRA_API_KEY}`).toString("base64")}`, }, body: JSON.stringify({ jql, startAt: nextPageToken || 0, maxResults: maxResults || 50, fields: fields || ["*all"], expand, }), }); if (!response.ok) { throw new Error(`Jira API Error: ${response.statusText}`); } const data = await response.json(); return { content: [ { type: "text", text: JSON.stringify(data, null, 2), // Format JSON response }, ], }; } catch (error) { return { isError: true, content: [ { type: "text", text: `Error: ${error.message}`, }, ], }; } } else if (name === "get_issue") {
- index.js:43-66 (schema)Input schema for the jql_search tool, defining parameters like jql (required), nextPageToken, maxResults, fields, and expand.inputSchema: { type: "object", properties: { jql: { type: "string", description: "JQL query string" }, nextPageToken: { type: "string", description: "Token for next page", }, maxResults: { type: "integer", description: "Maximum results to fetch", }, fields: { type: "array", items: { type: "string" }, description: "List of fields to return for each issue", }, expand: { type: "string", description: "Additional info to include in the response", }, }, required: ["jql"], },
- index.js:40-67 (registration)Registration of the jql_search tool in the ListToolsRequestSchema handler, including name, description, and input schema.{ name: "jql_search", description: "Perform enhanced JQL search in Jira", inputSchema: { type: "object", properties: { jql: { type: "string", description: "JQL query string" }, nextPageToken: { type: "string", description: "Token for next page", }, maxResults: { type: "integer", description: "Maximum results to fetch", }, fields: { type: "array", items: { type: "string" }, description: "List of fields to return for each issue", }, expand: { type: "string", description: "Additional info to include in the response", }, }, required: ["jql"], }, },