get_coordinates
Convert city names to latitude and longitude coordinates for weather data retrieval and location-based applications.
Instructions
Returns the latitude and longitude of the specified city as a tuple.
Args:
city: the city of
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| city | Yes |
Implementation Reference
- tools/get_forcast.py:6-13 (handler)Handler function for the 'get_coordinates' tool. It accepts a city name as input and returns a hardcoded tuple of latitude and longitude coordinates (San Francisco). The implementation notes to replace the hardcoded values with a real API call.def get_coordinates(city: str) -> Tuple[float, float]: """ Returns the latitude and longitude of the specified city as a tuple. Args: city: the city of """ # Hardcode replace it with you api to get the latitude and longitude of any city return (37.7749, -122.4194)
- tools/get_forcast.py:5-6 (registration)Registration of the 'get_coordinates' tool using the @mcp.tool() decorator within the register(mcp) function.@mcp.tool() def get_coordinates(city: str) -> Tuple[float, float]:
- tools/get_forcast.py:6-6 (schema)Input schema: city (str). Output schema: Tuple[float, float] for latitude and longitude.def get_coordinates(city: str) -> Tuple[float, float]: