Skip to main content
Glama

list_tickets

Retrieve user support tickets with optional status filtering to track and manage support requests within the FitSlot system.

Instructions

List all tickets for a user, optionally filtered by status

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
userIdYes
statusNo

Implementation Reference

  • The execute handler function for the list_tickets tool. Validates userId and optional status, fetches tickets via apiService.getTickets, formats response as JSON or error.
    execute: async (args: {
      userId: string;
      status?: string;
    }) => {
      try {
        logger.info('Listing tickets', args);
    
        validateNotEmpty(args.userId, 'User ID');
        if (args.status) {
          validateEnum(args.status, TicketStatus, 'Status');
        }
    
        const tickets = await apiService.getTickets(
          args.userId,
          args.status as TicketStatus | undefined
        );
    
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify(
                {
                  success: true,
                  count: tickets.length,
                  tickets: tickets.map(t => ({
                    id: t.id,
                    title: t.title,
                    status: t.status,
                    priority: t.priority,
                    createdAt: t.createdAt,
                    updatedAt: t.updatedAt
                  }))
                },
                null,
                2
              )
            }
          ]
        };
      } catch (error) {
        logger.error('Failed to list tickets', error);
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify(
                {
                  success: false,
                  error: error instanceof Error ? error.message : 'Unknown error'
                },
                null,
                2
              )
            }
          ],
          isError: true
        };
      }
    }
  • Zod schema defining input parameters for list_tickets: required userId (string), optional status (enum of ticket statuses).
    parameters: z.object({
      userId: z.string().describe('ID of the user'),
      status: z.enum(['open', 'in_progress', 'resolved', 'closed']).optional().describe('Filter by ticket status')
    }),
  • src/index.ts:60-68 (registration)
    Creates the ticketTools object (containing list_tickets) via createTicketTools and spreads it into allTools, which is used by MCP server's ListTools and CallTool request handlers for tool registration and execution.
    const ticketTools = createTicketTools(apiService);
    const chatbotTools = createChatbotTools(chatbotService);
    const pdfTools = createPDFTools(pdfService);
    
    const allTools = {
      ...ticketTools,
      ...chatbotTools,
      ...pdfTools
    };

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/osmarsant/fitslot-mcp'

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