Skip to main content
Glama

create_campaign

Initiate a new Dungeons & Dragons campaign by defining its name, description, Dungeon Master, and setting. Simplifies campaign creation for organized gameplay and storytelling.

Instructions

Create a new D&D campaign.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
descriptionYesBrief decription of the campaign, or a tagline
dm_nameNoDungeon Master name
nameYesCampaign name
settingNo Campaign setting - a full description of the setting of the campaign in markdown format, or the path to a `.txt` or `.md` file containing the same.

Implementation Reference

  • MCP tool handler for create_campaign: validates input via Annotated fields (serving as schema), calls storage layer, and returns formatted success message.
    @mcp.tool def create_campaign( name: Annotated[str, Field(description="Campaign name")], description: Annotated[str, Field(description="Brief decription of the campaign, or a tagline")], dm_name: Annotated[str | None, Field(description="Dungeon Master name")] = None, setting: Annotated[str | Path | None, Field(description=""" Campaign setting - a full description of the setting of the campaign in markdown format, or the path to a `.txt` or `.md` file containing the same. """)] = None, ) -> str: """Create a new D&D campaign.""" campaign = storage.create_campaign( name=name, description=description, dm_name=dm_name, setting=setting ) return f"🌟 Created campaign: '{campaign.name} and set as active 🌟'"
  • Core logic for instantiating Campaign model, setting as current, and persisting to JSON file.
    def create_campaign(self, name: str, description: str, dm_name: str | None = None, setting: str | Path | None = None) -> Campaign: """Create a new campaign.""" logger.info(f"✨ Creating new campaign: '{name}'") game_state = GameState(campaign_name=name) campaign = Campaign( name=name, description=description, dm_name=dm_name, setting=setting, game_state=game_state ) self._current_campaign = campaign self._save_campaign() logger.info(f"✅ Campaign '{name}' created and set as active.") return campaign
  • FastMCP decorator registering the create_campaign function as a tool.
    @mcp.tool

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