Skip to main content
Glama
study-flamingo

D&D MCP Server

list_characters

View all player and NPC characters in your current D&D campaign to manage your game roster and track character details.

Instructions

List all characters in the current campaign.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Handler function for the 'list_characters' tool. Decorated with @mcp.tool for registration. Lists all characters in the current campaign by fetching names from storage, retrieving details, and formatting a list.
    @mcp.tool
    def list_characters() -> str:
        """List all characters in the current campaign."""
        characters = storage.list_characters()
        if not characters:
            return "No characters in the current campaign."
    
        char_list = []
        for char_name in characters:
            char = storage.get_character(char_name)
            if char:
                char_list.append(f"• {char.name} (Level {char.character_class.level} {char.race.name} {char.character_class.name})")
    
        return "**Characters:**\n" + "\n".join(char_list)
  • Helper method in DnDStorage class that returns a list of character names from the current campaign's characters dictionary.
    def list_characters(self) -> list[str]:
        """List all character names in the current campaign."""
        if not self._current_campaign:
            return []
        return list(self._current_campaign.characters.keys())

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