jql_search
Search Jira issues using JQL queries to filter, sort, and retrieve specific issue data with customizable result fields.
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 function that executes the jql_search tool by sending a POST request to Jira's search API with the JQL query and optional parameters, returning 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 defining the parameters for the jql_search tool, including required JQL query and optional pagination, fields, etc.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 ListTools response, specifying 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"], }, },