Skip to main content
Glama

get-station-by-telecode

Retrieve detailed station information using the 3-letter telecode, including name, pinyin, and city data for Chinese railway queries and debugging purposes.

Instructions

通过车站的 station_telecode 查询车站的详细信息,包括名称、拼音、所属城市等。此接口主要用于在已知 telecode 的情况下获取更完整的车站数据,或用于特殊查询及调试目的。一般用户对话流程中较少直接触发。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
stationTelecodeYes车站的 `station_telecode` (3位字母编码)

Implementation Reference

  • The handler function executes the tool logic: checks if the station exists in the preloaded STATIONS map by telecode and returns the full station details as JSON or an error.
    async ({ stationTelecode }) => { if (!STATIONS[stationTelecode]) { return { content: [{ type: 'text', text: 'Error: Station not found. ' }], }; } return { content: [ { type: 'text', text: JSON.stringify(STATIONS[stationTelecode]) }, ], }; }
  • Zod schema defining the input parameter 'stationTelecode' as a string with description.
    { stationTelecode: z .string() .describe('车站的 `station_telecode` (3位字母编码)'), },
  • src/index.ts:662-682 (registration)
    Registration of the tool using server.tool(), including name, description, schema, and inline handler function.
    server.tool( 'get-station-by-telecode', '通过车站的 `station_telecode` 查询车站的详细信息,包括名称、拼音、所属城市等。此接口主要用于在已知 `telecode` 的情况下获取更完整的车站数据,或用于特殊查询及调试目的。一般用户对话流程中较少直接触发。', { stationTelecode: z .string() .describe('车站的 `station_telecode` (3位字母编码)'), }, async ({ stationTelecode }) => { if (!STATIONS[stationTelecode]) { return { content: [{ type: 'text', text: 'Error: Station not found. ' }], }; } return { content: [ { type: 'text', text: JSON.stringify(STATIONS[stationTelecode]) }, ], }; } );
  • Preloaded global STATIONS map (keyed by station_code/telecode) populated by getStations() function, directly used in the handler.
    const STATIONS: Record<string, StationData> = await getStations(); //以Code为键
  • TypeScript type definition for StationData, which structures the output data returned by the tool.
    export type StationData = { station_id: string; station_name: string; station_code: string; station_pinyin: string; station_short: string; station_index: string; code: string; city: string; r1: string; r2: string; };

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/freestylefly/12306-mcp'

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