Skip to main content
Glama

load_campaign

Utilize this tool to load a specific Dungeons & Dragons campaign into the MCP server, enabling efficient management of characters, quests, and session tracking. Specify the campaign name to initiate the process.

Instructions

Load a specific campaign.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesCampaign name to load

Implementation Reference

  • The primary MCP tool handler for 'load_campaign'. Decorated with @mcp.tool for registration, includes input schema via Annotated Field, executes by calling storage.load_campaign(name) and returns confirmation message.
    def load_campaign( name: Annotated[str, Field(description="Campaign name to load")] ) -> str: """Load a specific campaign.""" campaign = storage.load_campaign(name) return f"📖 Loaded campaign: '{campaign.name}'. Campaign is now active!"
  • Core helper method in DnDStorage class that performs the actual campaign loading: computes file path, reads JSON, validates with Pydantic Campaign model, sets as active current campaign, and returns it.
    def load_campaign(self, name: str) -> Campaign: """Load a specific campaign.""" logger.info(f"📂 Attempting to load campaign: '{name}'") campaign_file = self._get_campaign_file(name) logger.debug(f"📂 Campaign file path: {campaign_file}") if not campaign_file.exists(): logger.error(f"❌ Campaign file not found for '{name}'") raise FileNotFoundError(f"Campaign '{name}' not found") with open(campaign_file, 'r', encoding='utf-8') as f: data = json.load(f) self._current_campaign = Campaign.model_validate(data) logger.info(f"✅ Successfully loaded campaign '{name}'.") return self._current_campaign

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