Skip to main content
Glama
variflight

Variflight Tripmatch MCP Server

Official
by variflight

searchTrainStations

Find train stations by entering keywords like station names or locations to identify departure and arrival points for travel planning.

Instructions

Search for train stations by keyword.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesKeyword to search for train stations (e.g. 北京西)

Implementation Reference

  • dist/index.js:271-292 (registration)
    Registration of the 'searchTrainStations' MCP tool, including description, Zod input schema, and handler function that invokes the service and formats the response.
    server.tool("searchTrainStations", "Search for train stations by keyword.", { query: z.string().describe("Keyword to search for train stations (e.g. 北京西)"), }, async ({ query }) => { try { const trainStations = await flightService.searchTrainStations(query); return { content: [ { type: "text", text: JSON.stringify(trainStations, null, 2) } ] }; } catch (error) { console.error('Error searching train stations:', error); return { content: [{ type: "text", text: `Error: ${error.message}` }], isError: true }; } });
  • The handler function for the searchTrainStations tool, which extracts the query, calls the OpenAlService method, and returns structured content or error response.
    server.tool("searchTrainStations", "Search for train stations by keyword.", { query: z.string().describe("Keyword to search for train stations (e.g. 北京西)"), }, async ({ query }) => { try { const trainStations = await flightService.searchTrainStations(query); return { content: [ { type: "text", text: JSON.stringify(trainStations, null, 2) } ] }; } catch (error) { console.error('Error searching train stations:', error); return { content: [{ type: "text", text: `Error: ${error.message}` }], isError: true }; } });
  • Zod schema defining the input parameter 'query' as a string for the tool.
    query: z.string().describe("Keyword to search for train stations (e.g. 北京西)"),
  • Helper method in OpenAlService class that forwards the searchTrainStations request to the backend API via makeRequest.
    async searchTrainStations(query) { return this.makeRequest('searchTrainStations', { query }); }
  • TypeScript declaration for the searchTrainStations method signature.
    searchTrainStations(query: string): Promise<any>;

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