Skip to main content
Glama
study-flamingo

D&D MCP Server

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
NameRequiredDescriptionDefault
nameYesLocation name

Implementation Reference

  • 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)

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/study-flamingo/gamemaster-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server