Skip to main content
Glama
kornbed

Jira MCP Server for Cursor

update_status

Change the status of a Jira ticket by specifying the ticket ID and transition ID to move it through workflow stages.

Instructions

Update the status of a Jira ticket

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
ticketIdYesThe Jira ticket ID
statusYes

Implementation Reference

  • The handler function that performs the Jira status update by calling the doTransition API with the provided ticket ID and transition ID. Includes config validation and error handling.
    async ({ ticketId, status }: { ticketId: string; status: StatusUpdate }) => {
      const configError = validateJiraConfig();
      if (configError) {
        return {
          content: [{ type: "text", text: `Configuration error: ${configError}` }],
        };
      }
    
      try {
        await jira.issues.doTransition({
          issueIdOrKey: ticketId,
          transition: { id: status.transitionId },
        });
    
        return {
          content: [{ type: "text", text: `Updated status of ${ticketId}` }],
        };
      } catch (error) {
        return {
          content: [{ type: "text", text: `Failed to update status: ${(error as Error).message}` }],
        };
      }
    }
  • Zod schema for validating the 'status' input parameter of the update_status tool.
    const StatusUpdateSchema = z.object({
      transitionId: z.string().describe("The ID of the transition to perform"),
    });
  • TypeScript interface defining the shape of the status update input.
    interface StatusUpdate {
      transitionId: string;
    }
  • src/server.ts:345-375 (registration)
    Registration of the 'update_status' tool on the MCP server, specifying name, description, input schema, and handler function.
    server.tool(
      "update_status",
      "Update the status of a Jira ticket",
      {
        ticketId: z.string().describe("The Jira ticket ID"),
        status: StatusUpdateSchema,
      },
      async ({ ticketId, status }: { ticketId: string; status: StatusUpdate }) => {
        const configError = validateJiraConfig();
        if (configError) {
          return {
            content: [{ type: "text", text: `Configuration error: ${configError}` }],
          };
        }
    
        try {
          await jira.issues.doTransition({
            issueIdOrKey: ticketId,
            transition: { id: status.transitionId },
          });
    
          return {
            content: [{ type: "text", text: `Updated status of ${ticketId}` }],
          };
        } catch (error) {
          return {
            content: [{ type: "text", text: `Failed to update status: ${(error as Error).message}` }],
          };
        }
      }
    );
  • Helper function used by the handler to validate Jira configuration environment variables.
    // Helper function to validate Jira configuration
    function validateJiraConfig(): string | null {
      if (!process.env.JIRA_HOST) return "JIRA_HOST environment variable is not set";
      if (!process.env.JIRA_EMAIL) return "JIRA_EMAIL environment variable is not set";
      if (!process.env.JIRA_API_TOKEN) return "JIRA_API_TOKEN environment variable is not set";
      return null;
    }

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

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