get_locations
Retrieve all saved locations to manage your tasks by place.
Instructions
Get all saved locations.
Returns: List of locations
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/rtm_mcp/tools/utilities.py:120-155 (handler)The get_locations async function that implements the tool logic. It calls rtm.locations.getList via the RTM client, parses the response, and returns locations (id, name, lat, lng, zoom, address).
@mcp.tool() async def get_locations(ctx: Context) -> dict[str, Any]: """Get all saved locations. Returns: List of locations """ from ..client import RTMClient client: RTMClient = await get_client() result = await client.call("rtm.locations.getList") locations_data = result.get("locations", {}).get("location", []) if isinstance(locations_data, dict): locations_data = [locations_data] locations = [] for loc in locations_data: locations.append( { "id": loc.get("id"), "name": loc.get("name"), "latitude": float(loc.get("latitude", 0)), "longitude": float(loc.get("longitude", 0)), "zoom": int(loc.get("zoom", 0)) if loc.get("zoom") else None, "address": loc.get("address"), } ) return build_response( data={ "locations": locations, "count": len(locations), }, ) - src/rtm_mcp/server.py:106-106 (registration)Registration of all utility tools (including get_locations) via register_utility_tools(mcp, get_client).
register_utility_tools(mcp, get_client) - src/rtm_mcp/tools/utilities.py:10-13 (registration)The register_utility_tools function that decorates get_locations with @mcp.tool() to register it as an MCP tool.
def register_utility_tools(mcp: Any, get_client: Any) -> None: """Register utility and diagnostic tools.""" @mcp.tool()