Skip to main content
Glama

maps_bicycling_by_coordinates

Plan bicycle routes between coordinates using Amap data. Get distance, duration, and turn-by-turn navigation that considers bridges, one-way streets, and road closures for routes up to 500km.

Instructions

Plans a bicycle route between two coordinates.

Args: origin_coordinates (str): Starting point coordinates in the format "longitude,latitude" (e.g. "116.434307,39.90909") destination_coordinates (str): Ending point coordinates in the format "longitude,latitude" (e.g. "116.434307,39.90909") Returns: Dict[str, Any]: Route information including distance, duration, and turn-by-turn instructions. Considers bridges, one-way streets, and road closures. Supports routes up to 500km.

Input Schema

NameRequiredDescriptionDefault
origin_coordinatesYes
destination_coordinatesYes

Input Schema (JSON Schema)

{ "properties": { "destination_coordinates": { "title": "Destination Coordinates", "type": "string" }, "origin_coordinates": { "title": "Origin Coordinates", "type": "string" } }, "required": [ "origin_coordinates", "destination_coordinates" ], "type": "object" }

Implementation Reference

  • The main handler function for the 'maps_bicycling_by_coordinates' tool. It takes origin and destination coordinates, calls the Amap bicycling direction API, parses the response, and returns route data including paths and steps.
    @mcp.tool() def maps_bicycling_by_coordinates(origin_coordinates: str, destination_coordinates: str) -> Dict[str, Any]: """Plans a bicycle route between two coordinates. Args: origin_coordinates (str): Starting point coordinates in the format "longitude,latitude" (e.g. "116.434307,39.90909") destination_coordinates (str): Ending point coordinates in the format "longitude,latitude" (e.g. "116.434307,39.90909") Returns: Dict[str, Any]: Route information including distance, duration, and turn-by-turn instructions. Considers bridges, one-way streets, and road closures. Supports routes up to 500km. """ try: response = requests.get( "https://restapi.amap.com/v4/direction/bicycling", params={ "key": AMAP_MAPS_API_KEY, "origin": origin_coordinates, "destination": destination_coordinates } ) response.raise_for_status() data = response.json() if data.get("errcode") != 0: return {"error": f"Direction bicycling failed: {data.get('info') or data.get('infocode')}"} paths = [] for path in data["data"]["paths"]: steps = [] for step in path["steps"]: steps.append({ "instruction": step.get("instruction"), "road": step.get("road"), "distance": step.get("distance"), "orientation": step.get("orientation"), "duration": step.get("duration") }) paths.append({ "distance": path.get("distance"), "duration": path.get("duration"), "steps": steps }) return { "data": { "origin": data["data"]["origin"], "destination": data["data"]["destination"], "paths": paths } } except requests.exceptions.RequestException as e: return {"error": f"Request failed: {str(e)}"}
  • The @mcp.tool() decorator registers the maps_bicycling_by_coordinates function as an MCP tool.
    @mcp.tool()
  • The function signature and docstring define the input schema (two string coordinates) and output schema (Dict with route data).
    def maps_bicycling_by_coordinates(origin_coordinates: str, destination_coordinates: str) -> Dict[str, Any]: """Plans a bicycle route between two coordinates. Args: origin_coordinates (str): Starting point coordinates in the format "longitude,latitude" (e.g. "116.434307,39.90909") destination_coordinates (str): Ending point coordinates in the format "longitude,latitude" (e.g. "116.434307,39.90909") Returns: Dict[str, Any]: Route information including distance, duration, and turn-by-turn instructions. Considers bridges, one-way streets, and road closures. Supports routes up to 500km. """

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/sugarforever/amap-mcp-server'

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