list_locations
Retrieve and display all campaign locations within the D&D MCP Server to streamline campaign management and enhance session planning.
Instructions
List all locations in the current campaign.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/gamemaster_mcp/main.py:481-494 (handler)The MCP tool handler for 'list_locations', decorated with @mcp.tool (serving as registration). Retrieves and formats the list of locations from storage.@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)
- Core helper method in the Storage class that lists all location names from 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())