Skip to main content
Glama
imrnbeg

Jira MCP Server

by imrnbeg

Search Jira Issues (JQL)

search_jira_issues

Search Jira issues using JQL queries with pagination and customizable field selection to find specific tickets based on criteria like project, status, or assignee.

Instructions

Search issues using JQL with pagination and field selection.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
jqlYesJQL query (e.g., project=PROJ AND status="In Progress")
startAtNoPagination start index (default 0)
maxResultsNoPage size (1-100, default 50)
fieldsNoComma-separated fields to return (default: key,summary,status,assignee,priority,issuetype,updated)

Implementation Reference

  • The handler function executes the tool logic: constructs JQL search body, POSTs to Jira /search API, maps response issues to structured content with summaries, URLs, etc., handles pagination, errors.
    async (args: { jql: string; startAt?: number; maxResults?: number; fields?: string }) => {
      try {
        const body: any = {
          jql: args.jql,
          startAt: args.startAt ?? 0,
          maxResults: args.maxResults ?? 50,
          fields: (args.fields ? args.fields.split(",").map(s => s.trim()) : ["key","summary","status","assignee","priority","issuetype","updated"]).filter(Boolean)
        };
        const url = `${JIRA_URL}/rest/api/3/search`;
        const response = await fetch(url, { method: "POST", headers: getJiraHeaders(), body: JSON.stringify(body) });
        if (!response.ok) {
          const errorText = await response.text();
          return { content: [{ type: "text", text: `Failed to search issues: ${response.status} ${response.statusText}\n${errorText}` }], isError: true };
        }
        const data = await response.json() as any;
        const items = (data.issues || []).map((it: any) => ({ key: it.key, summary: it.fields?.summary, status: it.fields?.status?.name, assignee: it.fields?.assignee?.displayName, priority: it.fields?.priority?.name, type: it.fields?.issuetype?.name, updated: it.fields?.updated, url: `${JIRA_URL}/browse/${it.key}` }));
        return { content: [{ type: "text", text: `Found ${data.total ?? items.length} issues (showing ${items.length}).` }], structuredContent: { total: data.total ?? items.length, startAt: data.startAt ?? 0, maxResults: data.maxResults ?? items.length, issues: items, raw: data } };
      } catch (error) {
        return { content: [{ type: "text", text: `Error searching issues: ${error instanceof Error ? error.message : String(error)}` }], isError: true };
      }
    }
  • Input schema using Zod for validation of JQL query, pagination parameters (startAt, maxResults), and optional fields.
    {
      title: "Search Jira Issues (JQL)",
      description: "Search issues using JQL with pagination and field selection.",
      inputSchema: {
        jql: z.string().describe("JQL query (e.g., project=PROJ AND status=\"In Progress\")"),
        startAt: z.number().int().min(0).optional().describe("Pagination start index (default 0)"),
        maxResults: z.number().int().min(1).max(100).optional().describe("Page size (1-100, default 50)"),
        fields: z.string().optional().describe("Comma-separated fields to return (default: key,summary,status,assignee,priority,issuetype,updated)")
      },
    },
  • src/server.ts:240-273 (registration)
    Registration of the 'search_jira_issues' tool with McpServer, including name, schema, and handler reference.
    mcp.registerTool(
      "search_jira_issues",
      {
        title: "Search Jira Issues (JQL)",
        description: "Search issues using JQL with pagination and field selection.",
        inputSchema: {
          jql: z.string().describe("JQL query (e.g., project=PROJ AND status=\"In Progress\")"),
          startAt: z.number().int().min(0).optional().describe("Pagination start index (default 0)"),
          maxResults: z.number().int().min(1).max(100).optional().describe("Page size (1-100, default 50)"),
          fields: z.string().optional().describe("Comma-separated fields to return (default: key,summary,status,assignee,priority,issuetype,updated)")
        },
      },
      async (args: { jql: string; startAt?: number; maxResults?: number; fields?: string }) => {
        try {
          const body: any = {
            jql: args.jql,
            startAt: args.startAt ?? 0,
            maxResults: args.maxResults ?? 50,
            fields: (args.fields ? args.fields.split(",").map(s => s.trim()) : ["key","summary","status","assignee","priority","issuetype","updated"]).filter(Boolean)
          };
          const url = `${JIRA_URL}/rest/api/3/search`;
          const response = await fetch(url, { method: "POST", headers: getJiraHeaders(), body: JSON.stringify(body) });
          if (!response.ok) {
            const errorText = await response.text();
            return { content: [{ type: "text", text: `Failed to search issues: ${response.status} ${response.statusText}\n${errorText}` }], isError: true };
          }
          const data = await response.json() as any;
          const items = (data.issues || []).map((it: any) => ({ key: it.key, summary: it.fields?.summary, status: it.fields?.status?.name, assignee: it.fields?.assignee?.displayName, priority: it.fields?.priority?.name, type: it.fields?.issuetype?.name, updated: it.fields?.updated, url: `${JIRA_URL}/browse/${it.key}` }));
          return { content: [{ type: "text", text: `Found ${data.total ?? items.length} issues (showing ${items.length}).` }], structuredContent: { total: data.total ?? items.length, startAt: data.startAt ?? 0, maxResults: data.maxResults ?? items.length, issues: items, raw: data } };
        } catch (error) {
          return { content: [{ type: "text", text: `Error searching issues: ${error instanceof Error ? error.message : String(error)}` }], isError: true };
        }
      }
    );
  • Shared helper function that creates authentication headers using Jira email and API token, used by the search handler and other tools.
    function getJiraHeaders(): Record<string, string> {
      const auth = Buffer.from(`${JIRA_EMAIL}:${JIRA_API_TOKEN}`).toString('base64');
      return {
        'Authorization': `Basic ${auth}`,
        'Accept': 'application/json',
        'Content-Type': 'application/json',
      };
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions 'pagination and field selection,' which hints at some behavior, but doesn't describe critical aspects like authentication requirements, rate limits, error handling, or what the return format looks like (especially without an output schema). For a search tool with no annotation coverage, this leaves significant gaps.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence: 'Search issues using JQL with pagination and field selection.' It's front-loaded with the core purpose and includes all key capabilities without waste. Every word earns its place, making it highly concise and well-structured.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (search with JQL, pagination, field selection), no annotations, and no output schema, the description is incomplete. It doesn't explain the return format, error conditions, or behavioral constraints like rate limits or authentication needs. For a tool with 4 parameters and no structured output documentation, the description should provide more context to be fully helpful.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema fully documents all four parameters (jql, startAt, maxResults, fields) with descriptions and constraints. The description adds no additional parameter semantics beyond what's in the schema—it merely echoes 'JQL with pagination and field selection' without providing syntax examples or usage nuances. Baseline 3 is appropriate when the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Search issues using JQL with pagination and field selection.' It specifies the verb ('Search'), resource ('issues'), and key capabilities (JQL, pagination, field selection). However, it doesn't explicitly differentiate from sibling tools like 'list_project_issues' or 'list_sprint_issues', which might also retrieve issues in different ways.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. With multiple sibling tools that retrieve issues (e.g., 'list_project_issues', 'list_sprint_issues', 'get_jira_issue'), there's no indication that this is the primary tool for complex JQL-based searches versus simpler listing operations. The agent must infer usage from the name and description alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/imrnbeg/jira-mcp'

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