list_tickets
Retrieve support tickets from ITSM systems with optional filters by status, assignee, or platform.
Instructions
List tickets with optional filtering by status, assignee, or system
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| status | No | Filter by status | |
| assigned_to | No | Filter by assignee username | |
| limit | No | Max number of tickets to return | |
| system | No | ITSM system to use | jira |
Implementation Reference
- index.js:130-138 (handler)Business logic handler that filters tickets by status, assignee, and system, sorts by created_at descending, limits results, and returns a mapped subset of ticket fields.
function listTickets({ status, assigned_to, limit = 10, system } = {}) { let list = Array.from(tickets.values()); if (status && status !== 'all') list = list.filter(t => t.status === status); if (assigned_to) list = list.filter(t => t.assignee === assigned_to); if (system) list = list.filter(t => t.system === system); list.sort((a, b) => new Date(b.created_at) - new Date(a.created_at)); list = list.slice(0, limit); return { success: true, tickets: list.map(t => ({ id: t.id, title: t.title, status: t.status, priority: t.priority, system: t.system, created_at: t.created_at })), total: list.length }; } - index.js:247-267 (registration)MCP tool registration for 'list_tickets' with Zod schema for input validation and annotations for readOnly/idempotent hints.
server.tool( 'list_tickets', 'List tickets with optional filtering by status, assignee, or system', { status: z.enum(['open', 'in_progress', 'resolved', 'closed', 'all']).optional().describe('Filter by status'), assigned_to: z.string().optional().describe('Filter by assignee username'), limit: z.number().int().min(1).max(100).default(10).describe('Max number of tickets to return'), system: systemSchema.optional(), }, { title: 'List Tickets', readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false, }, async ({ status, assigned_to, limit, system }) => { const result = listTickets({ status, assigned_to, limit, system }); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] }; }, ); - index.js:67-70 (schema)Reusable Zod schema for the 'system' parameter used by list_tickets and other tools.
const systemSchema = z .enum(['servicenow', 'jira', 'zendesk', 'ivanti_neurons', 'cherwell']) .default('jira') .describe('ITSM system to use');