get_only_ticket_name_and_description
Extract ticket names and descriptions from Jira using a JQL query. Specify the number of results to retrieve, streamlining ticket data retrieval for efficient project management.
Instructions
Get the name and description of the requested tickets 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:730-759 (handler)The main handler logic for the 'get_only_ticket_name_and_description' tool. It executes a JQL query using the shared executeJQL helper, then maps the results to include only the ticket key, summary, and description, and returns them as JSON.case 'get_only_ticket_name_and_description': { 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 only the ticket name and description const tickets = response.issues.map((issue: any) => { return { key: issue.key, summary: issue.fields.summary, description: issue.fields.description, }; }); return { content: [ { type: 'text', text: JSON.stringify(tickets, null, 2), // Pretty print JSON }, ], }; }
- src/index.ts:65-79 (schema)Input schema definition for the tool, specifying JQL query and optional number of results.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:62-80 (registration)Registration of the tool in the ListToolsRequestSchema handler, including name, description, and input schema.name: 'get_only_ticket_name_and_description', description: 'Get the name and description of the requested tickets 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'], }, },
- src/index.ts:432-452 (helper)Shared helper function executeJQL that performs the actual API call to Jira's search endpoint with the provided JQL and fields.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, }; } }