Skip to main content
Glama
imrnbeg

Jira MCP Server

by imrnbeg

List Jira Projects

list_jira_projects

Retrieve accessible Jira projects with pagination and optional search filtering to manage project visibility and organization.

Instructions

List accessible Jira projects with pagination and optional query.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryNoOptional search query for project key/name
startAtNoPagination start index (default 0)
maxResultsNoPage size (1-100, default 50)

Implementation Reference

  • The handler function for the 'list_jira_projects' tool. It constructs a search query for Jira projects using optional parameters, fetches from the Jira API, processes the response into a list of projects, and returns formatted text content along with structured data including total count and pagination info.
    async (args: { query?: string; startAt?: number; maxResults?: number }) => {
      try {
        const params = new URLSearchParams();
        if (args.query) params.set("query", args.query);
        if (typeof args.startAt === "number") params.set("startAt", String(args.startAt));
        if (typeof args.maxResults === "number") params.set("maxResults", String(args.maxResults));
        const url = `${JIRA_URL}/rest/api/3/project/search${params.toString() ? `?${params.toString()}` : ""}`;
        const response = await fetch(url, { method: "GET", headers: getJiraHeaders() });
        if (!response.ok) {
          const errorText = await response.text();
          return { content: [{ type: "text", text: `Failed to list projects: ${response.status} ${response.statusText}\n${errorText}` }], isError: true };
        }
        const data = await response.json() as any;
        const projects = (data.values || []).map((p: any) => ({ id: p.id, key: p.key, name: p.name, lead: p.lead?.displayName, projectType: p.projectTypeKey }));
        return {
          content: [{ type: "text", text: `Found ${data.total ?? projects.length} projects (showing ${projects.length}).` }],
          structuredContent: { total: data.total ?? projects.length, startAt: data.startAt ?? 0, maxResults: data.maxResults ?? projects.length, projects },
        };
      } catch (error) {
        return { content: [{ type: "text", text: `Error listing projects: ${error instanceof Error ? error.message : String(error)}` }], isError: true };
      }
    }
  • The schema definition for the 'list_jira_projects' tool, including title, description, and Zod-based input schema for optional query, startAt, and maxResults parameters.
    {
      title: "List Jira Projects",
      description: "List accessible Jira projects with pagination and optional query.",
      inputSchema: {
        query: z.string().optional().describe("Optional search query for project key/name"),
        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)"),
      },
  • src/server.ts:148-181 (registration)
    The full registration of the 'list_jira_projects' tool via mcp.registerTool, including the tool name, schema, and handler implementation.
    mcp.registerTool(
      "list_jira_projects",
      {
        title: "List Jira Projects",
        description: "List accessible Jira projects with pagination and optional query.",
        inputSchema: {
          query: z.string().optional().describe("Optional search query for project key/name"),
          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)"),
        },
      },
      async (args: { query?: string; startAt?: number; maxResults?: number }) => {
        try {
          const params = new URLSearchParams();
          if (args.query) params.set("query", args.query);
          if (typeof args.startAt === "number") params.set("startAt", String(args.startAt));
          if (typeof args.maxResults === "number") params.set("maxResults", String(args.maxResults));
          const url = `${JIRA_URL}/rest/api/3/project/search${params.toString() ? `?${params.toString()}` : ""}`;
          const response = await fetch(url, { method: "GET", headers: getJiraHeaders() });
          if (!response.ok) {
            const errorText = await response.text();
            return { content: [{ type: "text", text: `Failed to list projects: ${response.status} ${response.statusText}\n${errorText}` }], isError: true };
          }
          const data = await response.json() as any;
          const projects = (data.values || []).map((p: any) => ({ id: p.id, key: p.key, name: p.name, lead: p.lead?.displayName, projectType: p.projectTypeKey }));
          return {
            content: [{ type: "text", text: `Found ${data.total ?? projects.length} projects (showing ${projects.length}).` }],
            structuredContent: { total: data.total ?? projects.length, startAt: data.startAt ?? 0, maxResults: data.maxResults ?? projects.length, projects },
          };
        } catch (error) {
          return { content: [{ type: "text", text: `Error listing projects: ${error instanceof Error ? error.message : String(error)}` }], isError: true };
        }
      }
    );
  • Helper function used by the tool to generate HTTP headers with Basic Auth for Jira API requests.
    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',
      };
    }
Behavior3/5

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

With no annotations provided, the description carries the full burden. It mentions pagination and optional querying, which are useful behavioral details, but doesn't cover other important aspects like authentication requirements, rate limits, error handling, or what 'accessible' means in terms of permissions. The disclosure is partial but not comprehensive.

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 that front-loads the core purpose ('List accessible Jira projects') and adds two key features ('with pagination and optional query'). There's no wasted verbiage, and every word earns its place.

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

Completeness3/5

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

For a list tool with no annotations and no output schema, the description is minimally adequate. It covers the basic action and key features but lacks details on output format, error cases, or integration with sibling tools. Given the context, it should provide more guidance on usage and results.

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 already fully documents all three parameters. The description adds no additional meaning beyond what's in the schema (e.g., it doesn't explain query syntax or pagination behavior further). This meets the baseline for high schema coverage.

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 verb ('List') and resource ('accessible Jira projects'), making the purpose immediately understandable. However, it doesn't explicitly distinguish this tool from sibling tools like 'get_jira_project' (singular) or 'list_project_issues', which might cause confusion about when to use each.

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 like 'get_jira_project' (for a single project) or 'search_jira_issues' (for issues rather than projects). It mentions optional querying but doesn't clarify use cases or prerequisites.

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