Skip to main content
Glama
variflight

Variflight Tripmatch MCP Server

Official
by variflight

getFlightPriceByCities

Retrieve flight prices between cities using IATA codes and departure date to compare travel costs and plan trips.

Instructions

Get flight price information by departure city, arrival city, and departure date. All city codes must be valid IATA 3-letter codes (e.g. HFE for Hefei, CAN for Guangzhou). Date must be in YYYY-MM-DD format.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dep_cityYesDeparture city IATA 3-letter code (e.g. HFE for Hefei)
arr_cityYesArrival city IATA 3-letter code (e.g. CAN for Guangzhou)
dep_dateYesDeparture 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

Implementation Reference

  • The handler function that executes the core logic of the 'getFlightPriceByCities' tool. It invokes the flight service method, formats the response as MCP content (JSON stringified), and handles errors by returning an error message.
    }, async ({ dep_city, arr_city, dep_date }) => {
        try {
            const flightPrices = await flightService.getFlightPriceByCities(dep_city, arr_city, dep_date);
            return {
                content: [
                    {
                        type: "text",
                        text: JSON.stringify(flightPrices, null, 2)
                    }
                ]
            };
        }
        catch (error) {
            console.error('Error getting flight prices by cities:', error);
            return {
                content: [{ type: "text", text: `Error: ${error.message}` }],
                isError: true
            };
        }
  • Zod schema for validating the tool's input parameters: departure city code, arrival city code (both IATA 3-letter uppercase), and departure date in YYYY-MM-DD format.
    dep_city: z.string()
        .length(3)
        .regex(/^[A-Z]{3}$/)
        .describe("Departure city IATA 3-letter code (e.g. HFE for Hefei)"),
    arr_city: z.string()
        .length(3)
        .regex(/^[A-Z]{3}$/)
        .describe("Arrival city IATA 3-letter code (e.g. CAN for Guangzhou)"),
    dep_date: z.string()
        .regex(/^\d{4}-\d{2}-\d{2}$/)
        .describe("Departure 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"),
  • dist/index.js:238-269 (registration)
    The server.tool registration for 'getFlightPriceByCities', including the tool name, description, input schema, and handler function.
    server.tool("getFlightPriceByCities", "Get flight price information by departure city, arrival city, and departure date. All city codes must be valid IATA 3-letter codes (e.g. HFE for Hefei, CAN for Guangzhou). Date must be in YYYY-MM-DD format.", {
        dep_city: z.string()
            .length(3)
            .regex(/^[A-Z]{3}$/)
            .describe("Departure city IATA 3-letter code (e.g. HFE for Hefei)"),
        arr_city: z.string()
            .length(3)
            .regex(/^[A-Z]{3}$/)
            .describe("Arrival city IATA 3-letter code (e.g. CAN for Guangzhou)"),
        dep_date: z.string()
            .regex(/^\d{4}-\d{2}-\d{2}$/)
            .describe("Departure 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"),
    }, async ({ dep_city, arr_city, dep_date }) => {
        try {
            const flightPrices = await flightService.getFlightPriceByCities(dep_city, arr_city, dep_date);
            return {
                content: [
                    {
                        type: "text",
                        text: JSON.stringify(flightPrices, null, 2)
                    }
                ]
            };
        }
        catch (error) {
            console.error('Error getting flight prices by cities:', error);
            return {
                content: [{ type: "text", text: `Error: ${error.message}` }],
                isError: true
            };
        }
    });
  • Helper method in OpenAlService class that performs the actual API request to the backend endpoint 'getFlightPriceByCities' by calling makeRequest with the parameters.
    async getFlightPriceByCities(dep_city, arr_city, dep_date) {
        return this.makeRequest('getFlightPriceByCities', {
            dep_city,
            arr_city,
            dep_date
        });
    }
Behavior2/5

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

No annotations are provided, so the description carries the full burden. It mentions format requirements (IATA codes, YYYY-MM-DD) and references 'getTodayDate' for date handling, but lacks critical behavioral details: it doesn't specify if this is a read-only operation, what kind of price information is returned (e.g., single quote, range, list), whether it requires authentication, or any rate limits. The description adds some context but is insufficient for a mutation-free tool with zero 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.

Conciseness5/5

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

The description is appropriately sized and front-loaded: the first sentence states the core purpose, followed by specific format requirements. Every sentence earns its place by providing essential constraints without redundancy. It's efficient and well-structured.

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 the tool's moderate complexity (3 parameters, no output schema, no annotations), the description is partially complete. It covers input formats and references date handling, but lacks details on output behavior, error cases, or integration with siblings. Without annotations or output schema, more context on what the tool returns would be beneficial, but it's adequate for a basic query tool.

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: it reiterates the IATA code requirement and date format, and mentions using 'getTodayDate' for incomplete dates, which is useful but not substantial. This meets the baseline for high schema coverage.

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

Purpose4/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: 'Get flight price information by departure city, arrival city, and departure date.' This specifies the verb ('Get'), resource ('flight price information'), and key parameters. However, it doesn't explicitly differentiate from sibling tools like 'searchFlightsByDepArr' which might serve similar purposes, preventing a perfect score.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. It mentions using 'getTodayDate' for date handling, but this is a prerequisite rather than a usage guideline. There's no comparison with sibling tools like 'searchFlightsByDepArr' or 'flightHappinessIndex' to help the agent choose appropriately.

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