create_program
Generate custom travel programs by specifying the name, start and end dates, and associated agency ID. Ensures clarity by prompting users for missing details before creation.
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
| Name | Required | Description | Default |
|---|---|---|---|
| agencyId | Yes | ID de la agencia a asociar con este programa | |
| endDate | Yes | 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 | |
| name | Yes | Nombre del programa | |
| startDate | Yes | Fecha de inicio del programa (DD-MM-YYYY), salvo que el usuario lo indique las fechas siempre deben ser en el futuro |
Implementation Reference
- src/handlers/tools.handler.ts:1170-1191 (handler)The main handler function for the 'create_program' MCP tool. It extracts arguments, formats dates, calls the ApiService.createProgram method, and returns the result in MCP format.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)}` }] } }
- The input schema and metadata definition for the 'create_program' tool, returned by listTools() method.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'] } },
- src/index.ts:44-47 (registration)Registration of the general callTool handler which dispatches to the specific tool implementation based on name.this.server.setRequestHandler( CallToolRequestSchema, async (request) => await this.toolsHandler.callTool(request.params.name, request.params.arguments, this.server) )
- src/services/api.service.ts:106-119 (helper)Helper method in ApiService that performs the actual HTTP POST request to the backend API to create the 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:38-41 (registration)Registration of the listTools handler which includes the 'create_program' tool in its response.this.server.setRequestHandler( ListToolsRequestSchema, async () => this.toolsHandler.listTools() )