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
| Name | Required | Description | Default |
|---|---|---|---|
| author | No | Comment author | agent |
| content | Yes | Comment content | |
| status | No | Comment status | open |
| ticket_id | Yes | Ticket ID | |
| type | No | Comment type | comment |
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 }); }
- src/mcp/tools/schemas.ts:192-214 (schema)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'], }, },
- src/mcp/tools/setup.ts:48-49 (registration)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);
- src/mcp/tools/setup.ts:13-13 (registration)The import statement that loads the 'add_comment' handler function for use in the MCP tool setup.import { handleAddComment } from './handlers/add-comment';