create_service
Generate and register new travel services with specified names, descriptions, and provider details on the LumbreTravel MCP Server for streamlined travel program management.
Instructions
Crear un servicio
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| description | Yes | Descripción del servicio | |
| name | Yes | Nombre del servicio | |
| provider | Yes |
Implementation Reference
- src/handlers/tools.handler.ts:1511-1517 (handler)Handler logic for the 'create_service' MCP tool. Extracts arguments and calls ApiService.createService, then returns the result as text content.case 'create_service': { const { name, description, provider } = args const service = await this.apiService.createService({ name, description, provider }) return { content: [{ type: 'text', text: JSON.stringify(service, null, 2) }] } }
- Input schema definition for the 'create_service' tool, including properties for name, description, and provider.name: 'create_service', description: 'Crear un servicio', inputSchema: { type: 'object', properties: { name: { type: 'string', description: 'Nombre del servicio' }, description: { type: 'string', description: 'Descripción del servicio' }, provider: { type: 'object', properties: { id: { type: 'string', description: 'ID del proveedor' }, name: { type: 'string', description: 'Nombre del proveedor' } } } }, required: ['name', 'description', 'provider'] } },
- src/index.ts:38-1541 (registration)Server registration of tool handlers: listTools for listing tools and callTool for executing any tool by name.this.server.setRequestHandler( ListToolsRequestSchema, async () => this.toolsHandler.listTools() ) // Configure handlers for tools this.server.setRequestHandler( CallToolRequestSchema, async (request) => await this.toolsHandler.callTool(request.params.name, request.params.arguments, this.server) ) } private setupErrorHandling (): void { // Handle general server errors this.server.onerror = (error) => { console.error('[LumbreTravel MCP Error]', error) } // Handle interrupt signal (Ctrl+C) process.on('SIGINT', async () => { await this.server.close() process.exit(0) }) // Handle uncaught exceptions process.on('uncaughtException', (error) => { console.error('[Uncaught Exception]', error) process.exit(1) }) // Handle unhandled promise rejections process.on('unhandledRejection', (reason, promise) => { console.error('[Unhandled Rejection]', reason) process.exit(1) }) } async run (): Promise<void> { try { // Create and initialize the stdio transport const transport = new StdioServerTransport() await this.server.connect(transport) // Start message (using stderr to avoid interfering with MCP communication) console.error(`${SERVER_CONFIG.name} MCP server running (v${SERVER_CONFIG.version})`) } catch (error) { console.error('Failed to start server:', error) process.exit(1) } } } // Start the server const server = new LumbreTravelServer() server.run().catch((error) => { console.error('Fatal error:', error) process.exit(1) })
- src/services/api.service.ts:670-685 (helper)Helper method in ApiService that performs the HTTP POST request to the external API to create a service.async createService (data: { name: string description: string provider: { id: string name: string } }) { const headers = await this.getHeaders() const response = await fetch(`${API_CONFIG.baseUrl}/integrations/mcp/service/create`, { method: 'POST', headers: { ...headers, 'Content-Type': 'application/json' }, body: JSON.stringify(data) }) return await this.handleResponse<any>(response) }