get_stats
Retrieve and analyze ticket statistics from mcptix by grouping data based on status or priority to track and manage project tasks effectively.
Instructions
Get statistics about tickets in the system
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| group_by | No | Field to group by | status |
Implementation Reference
- src/mcp/tools/handlers/get-stats.ts:5-20 (handler)The main execution function for the 'get_stats' tool. It fetches tickets, groups them by the specified field (status or priority), counts occurrences, and returns the statistics.export function handleGetStats(ticketQueries: TicketQueries, args: any): ToolResponse { const groupBy = args.group_by || 'status'; // Get all tickets const tickets = ticketQueries.getTickets({}, 'updated', 'desc', 1000, 0); // Group tickets by the specified field const stats: Record<string, number> = {}; for (const ticket of tickets) { const key = ticket[groupBy as keyof Ticket] as string; stats[key] = (stats[key] || 0) + 1; } return createSuccessResponse(stats); }
- src/mcp/tools/schemas.ts:260-274 (schema)The input schema definition for the 'get_stats' tool, specifying optional 'group_by' parameter with enum ['status', 'priority']. Included in toolSchemas array for MCP tool listing.{ name: 'get_stats', description: 'Get statistics about tickets in the system', inputSchema: { type: 'object', properties: { group_by: { type: 'string', description: 'Field to group by', enum: ['status', 'priority'], default: 'status', }, }, }, },
- src/mcp/tools/setup.ts:52-53 (registration)Registration of the 'get_stats' tool handler in the switch statement that dispatches tool calls to their respective handlers.case 'get_stats': return handleGetStats(ticketQueries, args);
- src/mcp/tools/setup.ts:15-15 (registration)Import of the 'get_stats' handler function into the setup module.import { handleGetStats } from './handlers/get-stats';