create_location
Generate and define new locations for Dungeons & Dragons campaigns by specifying name, type, description, and other details to enhance game world-building.
Instructions
Create a new location.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| description | Yes | Location description | |
| government | No | Government type | |
| location_type | Yes | Type of location (city, town, village, dungeon, etc.) | |
| name | Yes | Location name | |
| notable_features | No | Notable features | |
| notes | No | Additional notes | |
| population | No | Population (if applicable) |
Implementation Reference
- src/gamemaster_mcp/main.py:433-455 (handler)The @mcp.tool decorator registers the create_location function as an MCP tool. The function implements the tool logic by creating a Location object from input parameters and adding it to storage via storage.add_location.@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/main.py:435-442 (schema)Input schema defined via Annotated parameters with Pydantic Field descriptions and constraints.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:
- src/gamemaster_mcp/main.py:433-433 (registration)The tool is registered using the @mcp.tool decorator from FastMCP.@mcp.tool