Skip to main content
Glama

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
NameRequiredDescriptionDefault
attitudeNoAttitude towards party
bioNoA detailed, private bio for the NPC, including secrets.
descriptionNoA brief, public description of the NPC.
locationNoCurrent location
nameYesNPC name
notesNoAdditional notes
occupationNoNPC occupation
raceNoNPC race

Implementation Reference

  • 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}'"
  • 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}'"
  • Registration of the create_npc tool using FastMCP @mcp.tool decorator.
    @mcp.tool

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