Skip to main content
Glama

add_comment

Use this tool to add comments to tickets in mcptix, specifying author, content, status, and type to enhance ticket tracking and task management.

Instructions

Add a comment to a ticket

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
authorNoComment authoragent
contentYesComment content
statusNoComment statusopen
ticket_idYesTicket ID
typeNoComment typecomment

Implementation Reference

  • The main handler function for the 'add_comment' MCP tool. Validates inputs, checks ticket existence, creates a comment object, persists it via database queries, and returns a success response.
    export function handleAddComment(ticketQueries: TicketQueries, args: any): ToolResponse {
      if (!args.ticket_id) {
        throw new Error('Ticket ID is required');
      }
    
      if (!args.content) {
        throw new Error('Comment content is required');
      }
    
      // Check if ticket exists
      const existingTicket = ticketQueries.getTicketById(args.ticket_id);
      if (!existingTicket) {
        throw new Error(`Ticket with ID ${args.ticket_id} not found`);
      }
    
      const author = args.author || 'agent';
    
      // Create comment object
      const comment: Comment = {
        id: `comment-${Date.now()}`,
        ticket_id: args.ticket_id,
        content: args.content,
        author,
        timestamp: new Date().toISOString(),
      };
    
      // Add comment
      const commentId = ticketQueries.addComment(args.ticket_id, comment);
    
      return createSuccessResponse({ id: commentId, success: true });
    }
  • The input schema for the 'add_comment' tool, defining required parameters (ticket_id, content) and optional author, used for tool validation and documentation in MCP.
      name: 'add_comment',
      description: 'Add a comment to a ticket',
      inputSchema: {
        type: 'object',
        properties: {
          ticket_id: {
            type: 'string',
            description: 'Ticket ID',
          },
          content: {
            type: 'string',
            description: 'Comment content (supports markdown)',
          },
          author: {
            type: 'string',
            description: 'Comment author',
            enum: ['developer', 'agent'],
            default: 'agent',
          },
        },
        required: ['ticket_id', 'content'],
      },
    },
  • The switch case that registers and dispatches 'add_comment' tool calls to the corresponding handler function within the MCP tool request handler.
    case 'add_comment':
      return handleAddComment(ticketQueries, args);
  • The import statement that loads the 'add_comment' handler function for use in the MCP tool setup.
    import { handleAddComment } from './handlers/add-comment';
Install Server

Other Tools

Related 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/ownlytics/mcptix'

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