get_coordinates
Retrieve latitude and longitude for any specified city using the get_coordinates tool on the MCP Weather Server.
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)The main handler function for the 'get_coordinates' tool. It takes a city name and returns hardcoded latitude and longitude coordinates (San Francisco). Intended to be replaced 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-5 (registration)The decorator that registers the get_coordinates function as an MCP tool within the register(mcp) function.@mcp.tool()
- tools/get_forcast.py:6-6 (schema)Type hints defining the input schema (city: str) and output schema (Tuple[float, float]) for the tool.def get_coordinates(city: str) -> Tuple[float, float]: