Skip to main content
Glama

create_ticket

Submit support requests to FitSlot by creating tickets with title, description, priority level, and user identification for issue resolution.

Instructions

Create a new support ticket in the FitSlot system

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
titleYes
descriptionYes
priorityYes
userIdYes

Implementation Reference

  • Full implementation of the 'create_ticket' MCP tool, including description, Zod input schema, and execute handler that performs validation and delegates to the API service.
    create_ticket: {
      description: 'Create a new support ticket in the FitSlot system',
      parameters: z.object({
        title: z.string().describe('Title of the ticket'),
        description: z.string().describe('Detailed description of the issue or request'),
        priority: z.enum(['low', 'medium', 'high', 'urgent']).describe('Priority level of the ticket'),
        userId: z.string().describe('ID of the user creating the ticket')
      }),
      execute: async (args: {
        title: string;
        description: string;
        priority: string;
        userId: string;
      }) => {
        try {
          logger.info('Creating new ticket', args);
    
          // Validate inputs
          validateNotEmpty(args.title, 'Title');
          validateNotEmpty(args.description, 'Description');
          validateNotEmpty(args.userId, 'User ID');
          validateEnum(args.priority, TicketPriority, 'Priority');
    
          const ticket = await apiService.createTicket({
            title: args.title,
            description: args.description,
            priority: args.priority as TicketPriority,
            userId: args.userId
          });
    
          return {
            content: [
              {
                type: 'text',
                text: JSON.stringify(
                  {
                    success: true,
                    message: 'Ticket created successfully',
                    ticket: {
                      id: ticket.id,
                      title: ticket.title,
                      status: ticket.status,
                      priority: ticket.priority,
                      createdAt: ticket.createdAt
                    }
                  },
                  null,
                  2
                )
              }
            ]
          };
        } catch (error) {
          logger.error('Failed to create ticket', error);
          return {
            content: [
              {
                type: 'text',
                text: JSON.stringify(
                  {
                    success: false,
                    error: error instanceof Error ? error.message : 'Unknown error'
                  },
                  null,
                  2
                )
              }
            ],
            isError: true
          };
        }
      }
    },
  • src/index.ts:60-68 (registration)
    Registration of the ticket tools (including create_ticket) into the allTools object, which is used by the MCP server's ListTools and CallTool request handlers.
    const ticketTools = createTicketTools(apiService);
    const chatbotTools = createChatbotTools(chatbotService);
    const pdfTools = createPDFTools(pdfService);
    
    const allTools = {
      ...ticketTools,
      ...chatbotTools,
      ...pdfTools
    };
  • Helper method in FitSlotAPIService that handles the actual HTTP POST request to create a ticket on the backend API.
    async createTicket(request: CreateTicketRequest): Promise<Ticket> {
      try {
        const response = await this.client.post<Ticket>('/api/tickets', request);
        logger.info('Ticket created successfully', { ticketId: response.data.id });
        return response.data;
      } catch (error) {
        logger.error('Failed to create ticket', error);
        throw error;
      }
    }
  • TypeScript interface defining the request shape for creating a ticket, used by the API service and tool handler.
    export interface CreateTicketRequest {
      title: string;
      description: string;
      priority: TicketPriority;
      userId: string;
    }
  • Enum defining valid priority values for tickets, used in schema validation.
    export enum TicketPriority {
      LOW = 'low',
      MEDIUM = 'medium',
      HIGH = 'high',
      URGENT = 'urgent'

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