Skip to main content
Glama
lumile

LumbreTravel MCP Server

by lumile

create_program

Create new travel programs in the LumbreTravel system by specifying program name, start and end dates, and agency ID.

Instructions

Crea un nuevo programa de viajes. Antes de crear un nuevo programa se debe preguntar al si quiere que primero se busque el programa a ver si existe. Si no se especifica la fecha de inicio o fin del programa, no la asumas, pide al usuario que la especifique. Si no se especifica el ID de la agencia, pide al usuario que la especifique.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesNombre del programa
startDateYesFecha de inicio del programa (DD-MM-YYYY), salvo que el usuario lo indique las fechas siempre deben ser en el futuro
endDateYesFecha de fin del programa (DD-MM-YYYY), salvo que el usuario lo indique las fechas siempre deben ser en el futuro. Y la fecha de fin debe ser mayor que la fecha de inicio
agencyIdYesID de la agencia a asociar con este programa

Implementation Reference

  • Handler function for the 'create_program' tool. Extracts arguments, formats dates, calls apiService.createProgram, and returns formatted response.
    case 'create_program': { const { name, startDate, endDate, agencyId } = args const program = await this.apiService.createProgram({ name, startDate: formatDate(startDate), endDate: formatDate(endDate), agency: { id: agencyId } }) return { content: [{ type: 'text', text: `Programa "${name}" creado exitosamente.\n\nDetalles del programa:\n${JSON.stringify(program, null, 2)}` }] } }
  • Input schema definition and description for the 'create_program' tool in the listTools response.
    name: 'create_program', description: 'Crea un nuevo programa de viajes. Antes de crear un nuevo programa se debe preguntar al si quiere que primero se busque el programa a ver si existe. Si no se especifica la fecha de inicio o fin del programa, no la asumas, pide al usuario que la especifique. Si no se especifica el ID de la agencia, pide al usuario que la especifique.', inputSchema: { type: 'object', properties: { name: { type: 'string', description: 'Nombre del programa' }, startDate: { type: 'string', description: 'Fecha de inicio del programa (DD-MM-YYYY), salvo que el usuario lo indique las fechas siempre deben ser en el futuro' }, endDate: { type: 'string', description: 'Fecha de fin del programa (DD-MM-YYYY), salvo que el usuario lo indique las fechas siempre deben ser en el futuro. Y la fecha de fin debe ser mayor que la fecha de inicio' }, agencyId: { type: 'string', description: 'ID de la agencia a asociar con este programa' } }, required: ['name', 'startDate', 'endDate', 'agencyId'] } },
  • Helper method in ApiService that performs the HTTP POST request to the backend API endpoint for creating a program.
    async createProgram (data: { name: string startDate: string endDate: string agency: { id: string } }) { const headers = await this.getHeaders() const response = await fetch(`${API_CONFIG.baseUrl}/integrations/mcp/programs/create`, { method: 'POST', headers: { ...headers, 'Content-Type': 'application/json' }, body: JSON.stringify(data) }) return await this.handleResponse<any>(response) }
  • src/index.ts:42-47 (registration)
    Registers the callTool handler on the MCP server, which dispatches to the specific tool handler based on name, including 'create_program'.
    // Configure handlers for tools this.server.setRequestHandler( CallToolRequestSchema, async (request) => await this.toolsHandler.callTool(request.params.name, request.params.arguments, this.server) )
  • Utility function formatDate used in the handler to convert input dates to DD-MM-YYYY format before sending to API.
    export function formatDate (dateStr: unknown): string { // Type validation if (typeof dateStr !== 'string') { throw new McpError( ErrorCode.InvalidParams, 'Date must be a string in YYYY-MM-DD format' ) } // Try to parse the date with different formats const formats = [ 'YYYY-MM-DD', 'MM/DD/YYYY', 'DD MMMM YYYY', 'YYYY-MM-DDTHH:mm:ss.SSSZ', 'DD-MM-YYYY' ] const parsedDate = moment(dateStr, formats, true) // Check if the date is valid if (!parsedDate.isValid()) { throw new McpError( ErrorCode.InvalidParams, `Invalid date format: ${dateStr}` ) } // Additional validation for impossible dates const month = parsedDate.month() + 1 // moment uses 0-11 for months const day = parsedDate.date() if (month > 12 || month < 1 || day > 31 || day < 1) { throw new McpError( ErrorCode.InvalidParams, `Invalid date format: ${dateStr}` ) } // Return in the desired format return parsedDate.format('DD-MM-YYYY') }

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/lumile/lumbretravel-mcp'

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