execute_jql
Run JQL queries on Jira to fetch issue data via the REST API. Specify the query and number of results to retrieve and streamline issue tracking and management.
Instructions
Execute a JQL query on Jira on the api /rest/api/3/search. Do not use markdown in your query.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| jql | Yes | JQL query string | |
| number_of_results | No | Number of results to return |
Implementation Reference
- src/index.ts:432-452 (handler)Core handler function that executes the JQL query against the Jira /rest/api/3/search/jql endpoint, retrieves all fields, and returns the response data or error.async function executeJQL(jql: string, maxResults: number): Promise<any> { try { const params = { jql, // JQL query string maxResults, // Adjust as needed fields: '*all', // Request all fields }; const response = await axios.get(`${JIRA_URL}/rest/api/3/search/jql`, { headers: getAuthHeaders().headers, params, }); return response.data; } catch (error: any) { //return the error in a json return { error: error.response.data, }; } }
- src/index.ts:707-728 (handler)MCP CallToolRequestSchema dispatch handler for 'execute_jql': extracts arguments, validates JQL, calls executeJQL, and returns pretty-printed JSON response.case 'execute_jql': { const jql = String(request.params.arguments?.jql); const number_of_results = Number( request.params.arguments?.number_of_results ?? 1, ); if (!jql) { throw new Error('JQL query is required'); } const response = await executeJQL(jql, number_of_results); // Return the entire data from the response return { content: [ { type: 'text', text: JSON.stringify(response, null, 2), // Pretty print JSON }, ], }; }
- src/index.ts:44-58 (schema)Input schema for the execute_jql tool, defining jql (required string) and number_of_results (optional integer, default 1).inputSchema: { type: 'object', properties: { jql: { type: 'string', description: 'JQL query string', }, number_of_results: { type: 'integer', description: 'Number of results to return', default: 1, }, }, required: ['jql'], },
- src/index.ts:40-59 (registration)Tool registration in ListTools response: defines name, description, and inputSchema for execute_jql.{ name: 'execute_jql', description: 'Execute a JQL query on Jira on the api /rest/api/3/search/jql. Do not use markdown in your query.', inputSchema: { type: 'object', properties: { jql: { type: 'string', description: 'JQL query string', }, number_of_results: { type: 'integer', description: 'Number of results to return', default: 1, }, }, required: ['jql'], }, },