list_campaigns
Retrieve all available Dungeons & Dragons campaigns managed through the DM20 Protocol server for campaign selection and management.
Instructions
List all available campaigns.
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_campaigns"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/dm20_protocol/storage.py:508-527 (handler)The `DnDStorage.list_campaigns` method iterates through the campaign storage directory, detecting both legacy monolithic files and new split-format directories to return a sorted list of campaign names.
def list_campaigns(self) -> list[str]: """List all available campaigns (both monolithic and split formats).""" campaigns_dir = self.data_dir / "campaigns" if not campaigns_dir.exists(): return [] campaigns = [] # Find monolithic campaigns (JSON files) for f in campaigns_dir.glob("*.json"): campaigns.append(f.stem) # Find split campaigns (directories with campaign.json) for d in campaigns_dir.iterdir(): if d.is_dir(): campaign_file = d / "campaign.json" if campaign_file.exists(): campaigns.append(d.name) return sorted(campaigns)