Skip to main content
Glama

create_location

Generate new locations for Dungeons & Dragons campaigns by specifying name, type, description, population, government, and notable features.

Instructions

Create a new location.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesLocation name
location_typeYesType of location (city, town, village, dungeon, etc.)
descriptionYesLocation description
populationNoPopulation (if applicable)
governmentNoGovernment type
notable_featuresNoNotable features
notesNoAdditional notes

Implementation Reference

  • The handler function for the 'create_location' tool. It is registered via the @mcp.tool decorator. Validates input using Annotated Fields, creates a Location model instance, persists it via storage.add_location, and returns a confirmation message.
    @mcp.tool def create_location( name: Annotated[str, Field(description="Location name")], location_type: Annotated[str, Field(description="Type of location (city, town, village, dungeon, etc.)")], description: Annotated[str, Field(description="Location description")], population: Annotated[int | None, Field(description="Population (if applicable)", ge=0)] = None, government: Annotated[str | None, Field(description="Government type")] = None, notable_features: Annotated[list[str] | None, Field(description="Notable features")] = None, notes: Annotated[str, Field(description="Additional notes")] = "", ) -> str: """Create a new location.""" location = Location( name=name, location_type=location_type, description=description, population=population, government=government, notable_features=notable_features or [], notes=notes ) storage.add_location(location) return f"Created location '{location.name}' ({location.location_type})"
  • Pydantic BaseModel defining the schema for Location objects created by the 'create_location' tool.
    class Location(BaseModel): """Geographic location or settlement.""" id: str = Field(default_factory=lambda: random(length=8)) name: str location_type: str # city, town, village, dungeon, forest, etc. description: str population: int | None = None government: str | None = None notable_features: list[str] = Field(default_factory=list) npcs: list[str] = Field(default_factory=list) # NPC names connections: list[str] = Field(default_factory=list) # Connected locations notes: str = ""

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