update_ticket
Modify existing support tickets by updating their status, description, or priority level to reflect current progress and requirements.
Instructions
Update an existing ticket (status, description, or priority)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ticketId | Yes | ||
| status | No | ||
| description | No | ||
| priority | No |
Implementation Reference
- src/tools/ticket.tools.ts:213-273 (handler)The main execute handler for the 'update_ticket' MCP tool. Validates inputs, calls the API to update the ticket, handles errors, and returns formatted response.execute: async (args: { ticketId: string; status?: string; description?: string; priority?: string; }) => { try { logger.info('Updating ticket', args); validateNotEmpty(args.ticketId, 'Ticket ID'); if (args.status) { validateEnum(args.status, TicketStatus, 'Status'); } if (args.priority) { validateEnum(args.priority, TicketPriority, 'Priority'); } const ticket = await apiService.updateTicket({ id: args.ticketId, status: args.status as TicketStatus | undefined, description: args.description, priority: args.priority as TicketPriority | undefined }); return { content: [ { type: 'text', text: JSON.stringify( { success: true, message: 'Ticket updated successfully', ticket }, null, 2 ) } ] }; } catch (error) { logger.error('Failed to update ticket', error); return { content: [ { type: 'text', text: JSON.stringify( { success: false, error: error instanceof Error ? error.message : 'Unknown error' }, null, 2 ) } ], isError: true }; } }
- src/tools/ticket.tools.ts:207-212 (schema)Zod schema defining the input parameters for the 'update_ticket' tool used in MCP tool registration.parameters: z.object({ ticketId: z.string().describe('ID of the ticket to update'), status: z.enum(['open', 'in_progress', 'resolved', 'closed']).optional().describe('New status'), description: z.string().optional().describe('Updated description'), priority: z.enum(['low', 'medium', 'high', 'urgent']).optional().describe('Updated priority') }),
- src/index.ts:60-67 (registration)Registration of the ticket tools (including update_ticket) by calling createTicketTools and merging into the allTools object used by MCP handlers.const ticketTools = createTicketTools(apiService); const chatbotTools = createChatbotTools(chatbotService); const pdfTools = createPDFTools(pdfService); const allTools = { ...ticketTools, ...chatbotTools, ...pdfTools
- API service helper method that performs the HTTP PATCH request to update a ticket in the backend.async updateTicket(request: UpdateTicketRequest): Promise<Ticket> { try { const { id, ...updateData } = request; const response = await this.client.patch<Ticket>( `/api/tickets/${id}`, updateData ); logger.info('Ticket updated successfully', { ticketId: id }); return response.data; } catch (error) { logger.error('Failed to update ticket', error); throw error; } }
- src/types/index.ts:53-58 (schema)TypeScript type definition for UpdateTicketRequest used in the API service layer.export interface UpdateTicketRequest { id: string; status?: TicketStatus; description?: string; priority?: TicketPriority; }