Skip to main content
Glama
variflight

Variflight Tripmatch MCP Server

Official
by variflight

getFlightAndTrainTransferInfo

Find flight and train transfer options between cities using IATA airport codes and departure dates. Query transportation connections for multi-modal travel planning.

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

TableJSON Schema
NameRequiredDescriptionDefault
depdateYesFlight 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
depcityYesDeparture airport IATA 3-letter code (e.g. BJS for Beijing, CAN for Guangzhou)
arrcityYesArrival airport IATA 3-letter code (e.g. SHA for Shanghai, LAX for Los Angeles)

Implementation Reference

  • The inline asynchronous handler function for the MCP tool 'getFlightAndTrainTransferInfo'. It calls OpenAlService.getTransferInfo and formats the JSON response or error.
    }, 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
            };
        }
    });
  • Zod input schema validation for the tool parameters: 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)"),
    }, async ({ depcity, arrcity, depdate }) => {
  • dist/index.js:95-95 (registration)
    The server.tool call that registers the 'getFlightAndTrainTransferInfo' tool with MCP server, providing 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. ", {
  • The OpenAlService method getTransferInfo that implements the core logic by making an API request to the 'transfer' endpoint.
    async getTransferInfo(depcity, arrcity, depdate) {
        return this.makeRequest('transfer', {
            depcity,
            arrcity,
            depdate,
            "fromMCP": 1
        });
    }
  • The base makeRequest method in OpenAlService used by getTransferInfo to call the external API.
    async makeRequest(endpoint, params) {
        const url = new URL(config.api.baseUrl);
        const request_body = {
            endpoint: endpoint,
            params: params
        };
        const response = await fetch(url.toString(), {
            method: 'post',
            headers: {
                'X-VARIFLIGHT-KEY': config.api.apiKey || '',
                'Content-Type': 'application/json',
            },
            body: JSON.stringify(request_body),
        });
        if (!response.ok) {
            throw new Error(`API request failed: ${response.status} ${response.statusText}`);
        }
        return response.json();
    }
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden. It discloses behavioral traits such as date format requirements and the need to use getTodayDate for today's dates, but lacks details on rate limits, authentication needs, or what the output contains (e.g., transfer options, times, costs). This is adequate but has clear gaps for a tool with no annotation coverage.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is appropriately sized and front-loaded, starting with the core purpose followed by specific guidelines. Every sentence earns its place, though it could be slightly more structured (e.g., bullet points for clarity). No wasted words, making it efficient for an AI agent.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no annotations and no output schema, the description provides basic context like parameter formats and tool alternatives, but lacks details on behavioral aspects (e.g., error handling, response structure) and doesn't fully compensate for the absence of structured data. It's minimally viable but incomplete for a tool with 3 parameters and complex usage.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents all parameters thoroughly. The description adds minimal value beyond the schema, mentioning date format and airport code standards, but doesn't provide additional semantic context or usage examples. Baseline 3 is appropriate when the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose with specific verbs ('Get flight and train transfer info') and resources ('by departure city and arrival city and departure date'), distinguishing it from siblings like getFlightPriceByCities or searchFlightsByDepArr by focusing on transfer info rather than pricing or general flight searches.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It provides explicit usage guidance: 'For today's date, you MUST use getTodayDate tool instead of hardcoding any date,' directly naming an alternative tool and specifying when to use it, which helps differentiate from siblings like getTodayDate and ensures correct parameter handling.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/variflight/tripmatch-mcp'

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