Skip to main content
Glama
KS-GEN-AI

Jira MCP Server

by KS-GEN-AI

execute_jql

Execute JQL queries to search and retrieve Jira issues. Specify query string and result count to filter project data.

Instructions

Execute a JQL query on Jira on the api /rest/api/3/search/jql. Do not use markdown in your query.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
jqlYesJQL query string
number_of_resultsNoNumber of results to return

Implementation Reference

  • src/index.ts:40-59 (registration)
    Registration of the 'execute_jql' tool in the ListTools response, including name, description, and input schema.
    {
      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'],
      },
    },
  • Input schema for the 'execute_jql' tool defining parameters 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'],
    },
  • Core handler function that executes the JQL query by making an authenticated GET request to Jira's /rest/api/3/search/jql endpoint with specified parameters.
    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,
        };
      }
    }
  • MCP CallToolRequestSchema handler case for 'execute_jql': validates input, calls executeJQL, and returns the JSON response as text content.
    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
          },
        ],
      };
    }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/KS-GEN-AI/jira-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server