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.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "list_characters"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/gamemaster_mcp/main.py:351-364 (handler)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())