Skip to main content
Glama
study-flamingo

D&D MCP Server

create_npc

Generate non-player characters for Dungeons & Dragons campaigns with customizable attributes including name, race, occupation, and personality traits.

Instructions

Create a new NPC.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesNPC name
descriptionNoA brief, public description of the NPC.
bioNoA detailed, private bio for the NPC, including secrets.
raceNoNPC race
occupationNoNPC occupation
locationNoCurrent location
attitudeNoAttitude towards party
notesNoAdditional notes

Implementation Reference

  • The main handler function for the 'create_npc' tool, decorated with @mcp.tool for registration. It constructs an NPC instance from parameters and persists it via storage.
    @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}'"
  • Pydantic BaseModel defining the structure and validation for NPC objects created by the tool.
    class NPC(BaseModel):
        """Non-player character."""
        id: str = Field(default_factory=lambda: random(length=8))
        name: str
        description: str | None = None
        bio: str | None = None  # The NPC's backstory, motivations, and secrets.
        race: str | None = None
        occupation: str | None = None
        location: str | None = None
        attitude: str | None = None  # friendly, neutral, hostile, etc.
        notes: str = ""
        stats: dict[str, Any] | None = None  # Combat stats if needed
        relationships: dict[str, str] = Field(default_factory=dict)  # character_name: relationship
  • Helper method in DnDStorage class that persists the NPC to the current campaign's npcs dictionary and saves the campaign file.
    def add_npc(self, npc: NPC) -> None:
        """Add an NPC to the current campaign."""
        if not self._current_campaign:
            raise ValueError("No current campaign")
    
        self._current_campaign.npcs[npc.name] = npc
        self._current_campaign.updated_at = datetime.now()
        self._save_campaign()
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. While 'Create a new NPC' implies a write/mutation operation, it doesn't specify permissions required, whether creation is idempotent, what happens on failure, or what the response contains. For a mutation tool with zero annotation coverage, this leaves significant behavioral gaps.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise at just three words ('Create a new NPC'), with zero wasted language. It's front-loaded with the core action and resource, making it easy to parse quickly. This efficiency is appropriate given the tool's straightforward purpose.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity (8 parameters, mutation operation) and lack of both annotations and output schema, the description is insufficient. It doesn't explain what constitutes an NPC versus other entities, what happens after creation, or any system constraints. For a creation tool in what appears to be a game/campaign management system, more context is needed for proper use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, with each parameter well-documented in the schema itself (e.g., 'name' as 'NPC name', 'description' as 'A brief, public description', 'bio' as 'A detailed, private bio'). The description adds no parameter information beyond what the schema provides, so it meets the baseline of 3 where the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Create a new NPC' clearly states the action (create) and resource (NPC), making the basic purpose understandable. However, it doesn't differentiate this tool from similar creation tools like 'create_character' or 'create_location' among the siblings, leaving ambiguity about when to use this specific creation tool versus others.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines1/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. With sibling tools like 'create_character' and 'create_location' available, there's no indication whether NPCs are a subset of characters, how they differ, or any prerequisites for creation. This lack of context makes it difficult for an agent to choose correctly among similar tools.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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