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
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Location name | |
| location_type | Yes | Type of location (city, town, village, dungeon, etc.) | |
| description | Yes | Location description | |
| population | No | Population (if applicable) | |
| government | No | Government type | |
| notable_features | No | Notable features | |
| notes | No | Additional notes |
Implementation Reference
- src/gamemaster_mcp/main.py:433-455 (handler)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})"
- src/gamemaster_mcp/models.py:289-301 (schema)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 = ""