Skip to main content
Glama
kornbed

Jira MCP Server for Cursor

add_comment

Add comments to Jira tickets directly from the Cursor editor to provide updates, feedback, or additional information on issues.

Instructions

Add a comment to a Jira ticket

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
ticketIdYesThe Jira ticket ID
commentYes

Implementation Reference

  • The async handler function implementing the 'add_comment' tool logic: validates Jira configuration, calls jira.issueComments.addComment to add the comment to the ticket, and returns success or error response.
    async ({ ticketId, comment }: { ticketId: string; comment: JiraComment }) => {
      const configError = validateJiraConfig();
      if (configError) {
        return {
          content: [{ type: "text", text: `Configuration error: ${configError}` }],
        };
      }
    
      try {
        await jira.issueComments.addComment({
          issueIdOrKey: ticketId,
          comment: comment.body,
        });
    
        return {
          content: [{ type: "text", text: `Added comment to ${ticketId}` }],
        };
      } catch (error) {
        return {
          content: [{ type: "text", text: `Failed to add comment: ${(error as Error).message}` }],
        };
      }
    }
  • Zod schema defining the structure of the comment input (body: string) for the add_comment tool.
    const CommentSchema = z.object({
      body: z.string().describe("The comment text"),
    });
  • TypeScript interface for JiraComment used in the add_comment tool input parameters.
    interface JiraComment {
      body: string;
    }
  • src/server.ts:313-343 (registration)
    Registration of the 'add_comment' MCP tool via server.tool(), specifying name, description, input schema, and handler function.
    server.tool(
      "add_comment",
      "Add a comment to a Jira ticket",
      {
        ticketId: z.string().describe("The Jira ticket ID"),
        comment: CommentSchema,
      },
      async ({ ticketId, comment }: { ticketId: string; comment: JiraComment }) => {
        const configError = validateJiraConfig();
        if (configError) {
          return {
            content: [{ type: "text", text: `Configuration error: ${configError}` }],
          };
        }
    
        try {
          await jira.issueComments.addComment({
            issueIdOrKey: ticketId,
            comment: comment.body,
          });
    
          return {
            content: [{ type: "text", text: `Added comment to ${ticketId}` }],
          };
        } catch (error) {
          return {
            content: [{ type: "text", text: `Failed to add comment: ${(error as Error).message}` }],
          };
        }
      }
    );
  • Inline input schema object for the add_comment tool, including ticketId and comment (referencing CommentSchema).
    {
      ticketId: z.string().describe("The Jira ticket ID"),
      comment: CommentSchema,
    },

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