Skip to main content
Glama
imrnbeg

Jira MCP Server

by imrnbeg

get_project_statuses

Retrieve available statuses for each issue type in a Jira project to understand workflow states and transitions.

Instructions

Get available statuses for each issue type in a project.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectIdOrKeyYesProject key or ID (e.g., PROJ or 10001)

Implementation Reference

  • The handler function that implements the core logic of the 'get_project_statuses' tool by fetching issue types and statuses from the Jira project API endpoint.
    async (args: { projectIdOrKey: string }) => {
      try {
        const url = `${JIRA_URL}/rest/api/3/project/${encodeURIComponent(args.projectIdOrKey)}/statuses`;
        const response = await fetch(url, { method: "GET", headers: getJiraHeaders() });
        if (!response.ok) {
          const errorText = await response.text();
          return { content: [{ type: "text", text: `Failed to get statuses for ${args.projectIdOrKey}: ${response.status} ${response.statusText}\n${errorText}` }], isError: true };
        }
        const arr = await response.json() as any[];
        const summary = arr.map((t: any) => ({ issueType: t.name, statuses: (t.statuses || []).map((s: any) => s.name) }));
        return { content: [{ type: "text", text: `Found ${summary.length} issue types with statuses.` }], structuredContent: { projectIdOrKey: args.projectIdOrKey, types: summary, raw: arr } };
      } catch (error) {
        return { content: [{ type: "text", text: `Error getting project statuses for ${args.projectIdOrKey}: ${error instanceof Error ? error.message : String(error)}` }], isError: true };
      }
    }
  • Input schema definition using Zod for the tool's single parameter 'projectIdOrKey'.
    {
      title: "Get Project Issue Types and Statuses",
      description: "Get available statuses for each issue type in a project.",
      inputSchema: {
        projectIdOrKey: z.string().describe("Project key or ID (e.g., PROJ or 10001)"),
      },
    },
  • src/server.ts:213-237 (registration)
    Registration of the 'get_project_statuses' tool with the MCP server, including schema and handler.
    mcp.registerTool(
      "get_project_statuses",
      {
        title: "Get Project Issue Types and Statuses",
        description: "Get available statuses for each issue type in a project.",
        inputSchema: {
          projectIdOrKey: z.string().describe("Project key or ID (e.g., PROJ or 10001)"),
        },
      },
      async (args: { projectIdOrKey: string }) => {
        try {
          const url = `${JIRA_URL}/rest/api/3/project/${encodeURIComponent(args.projectIdOrKey)}/statuses`;
          const response = await fetch(url, { method: "GET", headers: getJiraHeaders() });
          if (!response.ok) {
            const errorText = await response.text();
            return { content: [{ type: "text", text: `Failed to get statuses for ${args.projectIdOrKey}: ${response.status} ${response.statusText}\n${errorText}` }], isError: true };
          }
          const arr = await response.json() as any[];
          const summary = arr.map((t: any) => ({ issueType: t.name, statuses: (t.statuses || []).map((s: any) => s.name) }));
          return { content: [{ type: "text", text: `Found ${summary.length} issue types with statuses.` }], structuredContent: { projectIdOrKey: args.projectIdOrKey, types: summary, raw: arr } };
        } catch (error) {
          return { content: [{ type: "text", text: `Error getting project statuses for ${args.projectIdOrKey}: ${error instanceof Error ? error.message : String(error)}` }], isError: true };
        }
      }
    );
  • Helper function to generate authentication headers required for all Jira API calls, used by the tool handler.
    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',
      };
    }

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