Skip to main content
Glama
study-flamingo

D&D MCP Server

get_npc

Retrieve detailed information about non-player characters in Dungeons & Dragons campaigns by specifying their name.

Instructions

Get NPC information.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesNPC name

Implementation Reference

  • The primary handler function for the 'get_npc' MCP tool. Registered via @mcp.tool decorator. Retrieves NPC data from storage and returns formatted string information.
    @mcp.tool
    def get_npc(
        name: Annotated[str, Field(description="NPC name")]
    ) -> str:
        """Get NPC information."""
        npc = storage.get_npc(name)
        if not npc:
            return f"NPC '{name}' not found."
    
        npc_info = f"""**{npc.name}** (`{npc.id}`)
    **Race:** {npc.race or 'Unknown'}
    **Occupation:** {npc.occupation or 'Unknown'}
    **Location:** {npc.location or 'Unknown'}
    **Attitude:** {npc.attitude or 'Neutral'}
    
    **Description:** {npc.description or 'No description available.'}
    **Bio:** {npc.bio or 'No bio available.'}
    
    **Notes:** {npc.notes or 'No additional notes.'}
    """
    
        return npc_info
  • Helper method in DnDStorage class that retrieves an NPC object by name from the current campaign's NPC dictionary.
    def get_npc(self, name: str) -> NPC | None:
        """Get an NPC by name."""
        if not self._current_campaign:
            return None
        return self._current_campaign.npcs.get(name)
  • Input schema definition using Pydantic Annotated and Field for the 'name' parameter.
        name: Annotated[str, Field(description="NPC name")]
    ) -> str:
  • Tool registration decorator @mcp.tool applied to the get_npc function.
    @mcp.tool
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. It states the tool retrieves information, implying it's a read-only operation, but doesn't specify if it requires authentication, has rate limits, returns structured data, or handles errors (e.g., if the NPC doesn't exist). This leaves significant gaps for an agent to understand how to interact with it effectively.

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 three words, with zero wasted language. It's front-loaded with the core action ('Get NPC information'), making it easy to parse quickly. Every word earns its place by conveying the essential purpose without redundancy.

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 tool's complexity (a read operation with one parameter) and lack of annotations or output schema, the description is incomplete. It doesn't explain what information is returned (e.g., JSON structure, fields like health or alignment), error conditions, or how it fits into the broader RPG context with siblings. This leaves the agent with insufficient context for reliable 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?

The input schema has 100% description coverage, with the single parameter 'name' clearly documented as 'NPC name'. The description adds no additional meaning beyond this, such as format examples (e.g., case sensitivity) or context (e.g., must match an existing NPC). With high schema coverage, the baseline score of 3 is appropriate, as 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 'Get NPC information' clearly states the verb ('Get') and resource ('NPC information'), making the basic purpose understandable. However, it's vague about what specific information is retrieved (e.g., stats, backstory, location) and doesn't differentiate from sibling tools like 'list_npcs' (which likely lists multiple NPCs) or 'get_character' (which might handle player characters).

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

Usage Guidelines2/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. It doesn't mention prerequisites (e.g., needing a specific NPC name), exclusions, or comparisons to siblings like 'list_npcs' (for browsing) or 'get_character' (for other character types). Usage is implied only by the tool name and basic purpose.

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