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
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | NPC name |
Implementation Reference
- src/gamemaster_mcp/main.py:393-414 (handler)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)