list_locations
Retrieve all campaign locations to manage your D&D world, track settings, and organize adventure sites.
Instructions
List all locations in the current campaign.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "list_locations"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/gamemaster_mcp/main.py:481-494 (handler)The MCP tool handler function that lists all locations in the current campaign by retrieving the list from storage and formatting it nicely for display.
@mcp.tool def list_locations() -> str: """List all locations in the current campaign.""" locations = storage.list_locations() if not locations: return "No locations in the current campaign." loc_list = [] for loc_name in locations: loc = storage.get_location(loc_name) if loc: loc_list.append(f"• {loc.name} ({loc.location_type})") return "**Locations:**\n" + "\n".join(loc_list) - Helper method in DnDStorage class that returns the names of all locations in the current campaign.
def list_locations(self) -> list[str]: """List all location names.""" if not self._current_campaign: return [] return list(self._current_campaign.locations.keys())