get-station-by-telecode
Retrieve detailed Chinese railway station information, including name, pinyin, and city, using the station's 3-letter telecode. Ideal for specific queries or debugging on the 12306-MCP server.
Instructions
通过车站的 station_telecode 查询车站的详细信息,包括名称、拼音、所属城市等。此接口主要用于在已知 telecode 的情况下获取更完整的车站数据,或用于特殊查询及调试目的。一般用户对话流程中较少直接触发。
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| stationTelecode | Yes | 车站的 `station_telecode` (3位字母编码) |
Implementation Reference
- src/index.ts:662-682 (registration)Registration of the 'get-station-by-telecode' tool via server.tool(), including inline schema and handler implementation. The handler performs a simple lookup in the global STATIONS object.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]) }, ], }; } );
- src/index.ts:670-681 (handler)The core handler function that executes the tool logic: checks if station exists in STATIONS by telecode, returns JSON details or error.async ({ stationTelecode }) => { if (!STATIONS[stationTelecode]) { return { content: [{ type: 'text', text: 'Error: Station not found. ' }], }; } return { content: [ { type: 'text', text: JSON.stringify(STATIONS[stationTelecode]) }, ], }; }
- src/index.ts:665-669 (schema)Input schema defined with Zod for the stationTelecode parameter (string, 3-letter code).{ stationTelecode: z .string() .describe('车站的 `station_telecode` (3位字母编码)'), },