create_npc
Generate and customize Non-Player Characters (NPCs) for Dungeons & Dragons campaigns. Define name, race, occupation, location, attitude, and detailed bios to enhance storytelling and gameplay.
Instructions
Create a new NPC.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| attitude | No | Attitude towards party | |
| bio | No | A detailed, private bio for the NPC, including secrets. | |
| description | No | A brief, public description of the NPC. | |
| location | No | Current location | |
| name | Yes | NPC name | |
| notes | No | Additional notes | |
| occupation | No | NPC occupation | |
| race | No | NPC race |
Implementation Reference
- src/gamemaster_mcp/main.py:367-392 (handler)The create_npc tool handler: defines input schema via Annotated fields and implements NPC creation using the NPC model and storage layer.@mcp.tool def create_npc( name: Annotated[str, Field(description="NPC name")], description: Annotated[str | None, Field(description="A brief, public description of the NPC.")] = None, bio: Annotated[str | None, Field(description="A detailed, private bio for the NPC, including secrets.")] = None, race: Annotated[str | None, Field(description="NPC race")] = None, occupation: Annotated[str | None, Field(description="NPC occupation")] = None, location: Annotated[str | None, Field(description="Current location")] = None, attitude: Annotated[Literal["friendly", "neutral", "hostile", "unknown"] | None, Field(description="Attitude towards party")] = None, notes: Annotated[str, Field(description="Additional notes")] = "", ) -> str: """Create a new NPC.""" npc = NPC( name=name, description=description, bio=bio, race=race, occupation=occupation, location=location, attitude=attitude, notes=notes ) storage.add_npc(npc) return f"Created NPC '{npc.name}'"
- src/gamemaster_mcp/main.py:368-392 (schema)Input schema for create_npc tool defined via Pydantic Annotated fields in the function signature.def create_npc( name: Annotated[str, Field(description="NPC name")], description: Annotated[str | None, Field(description="A brief, public description of the NPC.")] = None, bio: Annotated[str | None, Field(description="A detailed, private bio for the NPC, including secrets.")] = None, race: Annotated[str | None, Field(description="NPC race")] = None, occupation: Annotated[str | None, Field(description="NPC occupation")] = None, location: Annotated[str | None, Field(description="Current location")] = None, attitude: Annotated[Literal["friendly", "neutral", "hostile", "unknown"] | None, Field(description="Attitude towards party")] = None, notes: Annotated[str, Field(description="Additional notes")] = "", ) -> str: """Create a new NPC.""" npc = NPC( name=name, description=description, bio=bio, race=race, occupation=occupation, location=location, attitude=attitude, notes=notes ) storage.add_npc(npc) return f"Created NPC '{npc.name}'"
- src/gamemaster_mcp/main.py:367-367 (registration)Registration of the create_npc tool using FastMCP @mcp.tool decorator.@mcp.tool