Skip to main content
Glama

list_npcs

Retrieve a full list of non-player characters (NPCs) in your Dungeons & Dragons campaign to manage and reference them efficiently.

Instructions

List all NPCs in the current campaign.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The MCP tool handler for 'list_npcs'. Decorated with @mcp.tool for registration. Fetches NPC list from storage, retrieves details for each, and formats a bullet list with names and locations.
    def list_npcs() -> str: """List all NPCs in the current campaign.""" npcs = storage.list_npcs() if not npcs: return "No NPCs in the current campaign." npc_list = [] for npc_name in npcs: npc = storage.get_npc(npc_name) if npc: location = f" ({npc.location})" if npc.location else "" npc_list.append(f"• {npc.name}{location}") return "**NPCs:**\n" + "\n".join(npc_list)
  • Helper method in CampaignStorage class that returns the list of NPC names (keys) from the current campaign's npcs dictionary.
    def list_npcs(self) -> list[str]: """List all NPC names.""" if not self._current_campaign: return [] return list(self._current_campaign.npcs.keys())
  • The @mcp.tool decorator registers the list_npcs function as an MCP tool.
    @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