get_location
Retrieve detailed location information for Dungeons & Dragons campaigns by entering a location name to support world-building and adventure planning.
Instructions
Get location information.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Location name |
Implementation Reference
- src/gamemaster_mcp/main.py:457-479 (handler)The @mcp.tool decorated handler function for the 'get_location' tool. Retrieves location data using storage.get_location and formats it into a detailed markdown string response.@mcp.tool def get_location( name: Annotated[str, Field(description="Location name")] ) -> str: """Get location information.""" location = storage.get_location(name) if not location: return f"Location '{name}' not found." loc_info = f"""**{location.name}** ({location.location_type}) **Description:** {location.description} **Population:** {location.population or 'Unknown'} **Government:** {location.government or 'Unknown'} **Notable Features:** {chr(10).join(['• ' + feature for feature in location.notable_features]) if location.notable_features else 'None listed'} **Notes:** {location.notes or 'No additional notes.'} """ return loc_info
- Supporting method in DnDStorage class that fetches the Location model instance by name from the current campaign's locations dictionary, used by the tool handler.def get_location(self, name: str) -> Location | None: """Get a location by name.""" if not self._current_campaign: return None return self._current_campaign.locations.get(name)