maps_bicycling
Plan bicycle routes for commuting by considering overpasses, one-way streets, and road closures. Supports routes up to 500km between specified coordinates.
Instructions
骑行路径规划用于规划骑行通勤方案,规划时会考虑天桥、单行线、封路等情况。最大支持 500km 的骑行路线规划
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| origin | Yes | 出发点经纬度,坐标格式为:经度,纬度 | |
| destination | Yes | 目的地经纬度,坐标格式为:经度,纬度 |
Implementation Reference
- build/index.js:445-492 (handler)The handleBicycling function implements the core logic for the maps_bicycling tool by querying the AMAP API for bicycling routes between origin and destination.async function handleBicycling(origin, destination) { const url = new URL("https://restapi.amap.com/v4/direction/bicycling"); url.searchParams.append("key", AMAP_MAPS_API_KEY); url.searchParams.append("origin", origin); url.searchParams.append("destination", destination); url.searchParams.append("source", "ts_mcp"); const response = await fetch(url.toString()); const data = await response.json(); if (data.errcode !== 0) { return { content: [{ type: "text", text: `Direction bicycling failed: ${data.info || data.infocode}`, }], isError: true, }; } return { content: [{ type: "text", text: JSON.stringify( { data: { origin: data.data.origin, destination: data.data.destination, paths: data.data.paths.map((path) => { return { distance: path.distance, duration: path.duration, steps: path.steps.map((step) => { return { instruction: step.instruction, road: step.road, distance: step.distance, orientation: step.orientation, duration: step.duration, }; }), }; }), }, }, null, 2, ), }], isError: false, };
- build/index.js:79-97 (schema)Schema definition for the maps_bicycling tool, including input schema for origin and destination coordinates.const BICYCLING_TOOL = { name: "maps_bicycling", description: "骑行路径规划用于规划骑行通勤方案,规划时会考虑天桥、单行线、封路等情况。最大支持 500km 的骑行路线规划", inputSchema: { type: "object", properties: { origin: { type: "string", description: "出发点经纬度,坐标格式为:经度,纬度", }, destination: { type: "string", description: "目的地经纬度,坐标格式为:经度,纬度", }, }, required: ["origin", "destination"], }, };
- build/index.js:874-877 (registration)Registration of the maps_bicycling tool in the CallToolRequestSchema handler switch statement.case "maps_bicycling": { const { origin, destination } = request.params.arguments; return await handleBicycling(origin, destination); }
- build/streamable-http.js:229-281 (handler)Duplicate implementation of the handleBicycling function in the HTTP server version.async function handleBicycling(origin, destination) { const AMAP_MAPS_API_KEY = getApiKey(); const url = new URL("https://restapi.amap.com/v4/direction/bicycling"); url.searchParams.append("key", AMAP_MAPS_API_KEY); url.searchParams.append("origin", origin); url.searchParams.append("destination", destination); url.searchParams.append("source", "ts_mcp"); const response = await fetch(url.toString()); const data = await response.json(); if (data.errcode !== 0) { return { content: [ { type: "text", text: `Direction bicycling failed: ${data.info || data.infocode}`, }, ], isError: true, }; } return { content: [ { type: "text", text: JSON.stringify( { data: { origin: data.data.origin, destination: data.data.destination, paths: data.data.paths.map((path) => { return { distance: path.distance, duration: path.duration, steps: path.steps.map((step) => { return { instruction: step.instruction, road: step.road, distance: step.distance, orientation: step.orientation, duration: step.duration, }; }), }; }), }, }, null, 2, ), }, ], isError: false, };
- build/streamable-http.js:723-741 (schema)Schema definition for the maps_bicycling tool in the HTTP server factory function.const BICYCLING_TOOL = { name: "maps_bicycling", description: "骑行路径规划用于规划骑行通勤方案,规划时会考虑天桥、单行线、封路等情况。最大支持 500km 的骑行路线规划", inputSchema: { type: "object", properties: { origin: { type: "string", description: "出发点经纬度,坐标格式为:经度,纬度", }, destination: { type: "string", description: "目的地经纬度,坐标格式为:经度,纬度", }, }, required: ["origin", "destination"], }, };