Skip to main content
Glama

list_campaigns

Retrieve a full list of campaigns from the Dungeons & Dragons MCP Server to manage characters, NPCs, locations, quests, and session tracking efficiently.

Instructions

List all available campaigns.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • MCP tool handler for 'list_campaigns'. Lists all campaigns from storage, marks the current one, and formats as a markdown list.
    @mcp.tool def list_campaigns() -> str: """List all available campaigns.""" campaigns = storage.list_campaigns() if not campaigns: return f"❌ No campaigns found in {storage.data_dir}!" current = storage.get_current_campaign() current_name = current.name if current else None campaign_list = [] for campaign in campaigns: marker = " (current)" if campaign == current_name else "" campaign_list.append(f"• {campaign}{marker}") return "**Available Campaigns:**\n" + "\n".join(campaign_list)
  • Helper method in DnDStorage class that scans the campaigns directory and returns a list of campaign names (JSON file stems). Called by the main handler.
    def list_campaigns(self) -> list[str]: """List all available campaigns.""" campaigns_dir = self.data_dir / "campaigns" if not campaigns_dir.exists(): return [] return [f.stem for f in campaigns_dir.glob("*.json")]

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