Skip to main content
Glama

get_npc

Retrieve detailed information about a specific NPC in a Dungeons & Dragons campaign using the provided NPC name. Ideal for campaign management and role-playing assistance.

Instructions

Get NPC information.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesNPC name

Implementation Reference

  • MCP tool handler for 'get_npc': retrieves NPC from storage and formats detailed information as a string.
    @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
  • Storage class method that retrieves an NPC 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)

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