getFlightAndTrainTransferInfo
Retrieve flight and train transfer details by entering departure and arrival city IATA codes along with the departure date in YYYY-MM-DD format. Use this tool to plan multi-modal travel connections.
Instructions
Get flight and train transfer info by departure city and arrival city and departure date. Date format: YYYY-MM-DD. IMPORTANT: For today's date, you MUST use getTodayDate tool instead of hardcoding any date. Airport codes should be IATA 3-letter codes.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| arrcity | Yes | Arrival airport IATA 3-letter code (e.g. SHA for Shanghai, LAX for Los Angeles) | |
| depcity | Yes | Departure airport IATA 3-letter code (e.g. BJS for Beijing, CAN for Guangzhou) | |
| depdate | Yes | Flight date in YYYY-MM-DD format. IMPORTANT: If user input only cotains month and date, you should use getTodayDate tool to get the year. For today's date, use getTodayDate tool instead of hardcoding |
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"arrcity": {
"description": "Arrival airport IATA 3-letter code (e.g. SHA for Shanghai, LAX for Los Angeles)",
"maxLength": 3,
"minLength": 3,
"pattern": "^[A-Z]{3}$",
"type": "string"
},
"depcity": {
"description": "Departure airport IATA 3-letter code (e.g. BJS for Beijing, CAN for Guangzhou)",
"maxLength": 3,
"minLength": 3,
"pattern": "^[A-Z]{3}$",
"type": "string"
},
"depdate": {
"description": "Flight date in YYYY-MM-DD format. IMPORTANT: If user input only cotains month and date, you should use getTodayDate tool to get the year. For today's date, use getTodayDate tool instead of hardcoding",
"pattern": "^\\d{4}-\\d{2}-\\d{2}$",
"type": "string"
}
},
"required": [
"depdate",
"depcity",
"arrcity"
],
"type": "object"
}
Implementation Reference
- dist/index.js:107-126 (handler)MCP tool handler function that invokes the flight service to get transfer info and formats the response.}, async ({ depcity, arrcity, depdate }) => { try { const flights = await flightService.getTransferInfo(depcity, arrcity, depdate); return { content: [ { type: "text", text: JSON.stringify(flights, null, 2) } ] }; } catch (error) { console.error('Error searching flights by number:', error); return { content: [{ type: "text", text: `Error: ${error.message}` }], isError: true }; } });
- dist/index.js:96-106 (schema)Zod input schema defining parameters for the tool: depdate, depcity, arrcity.depdate: z.string() .regex(/^\d{4}-\d{2}-\d{2}$/) .describe("Flight date in YYYY-MM-DD format. IMPORTANT: If user input only cotains month and date, you should use getTodayDate tool to get the year. For today's date, use getTodayDate tool instead of hardcoding"), depcity: z.string() .length(3) .regex(/^[A-Z]{3}$/) .describe("Departure airport IATA 3-letter code (e.g. BJS for Beijing, CAN for Guangzhou)"), arrcity: z.string() .length(3) .regex(/^[A-Z]{3}$/) .describe("Arrival airport IATA 3-letter code (e.g. SHA for Shanghai, LAX for Los Angeles)"),
- dist/index.js:95-95 (registration)Registers the tool with MCP server, including name, description, schema, and handler.server.tool("getFlightAndTrainTransferInfo", "Get flight and train transfer info by departure city and arrival city and departure date. Date format: YYYY-MM-DD. IMPORTANT: For today's date, you MUST use getTodayDate tool instead of hardcoding any date. Airport codes should be IATA 3-letter codes. ", {
- dist/services/openalService.js:43-50 (helper)Helper method in OpenAlService that makes the API request to the 'transfer' endpoint for flight and train transfer information.async getTransferInfo(depcity, arrcity, depdate) { return this.makeRequest('transfer', { depcity, arrcity, depdate, "fromMCP": 1 }); }