Skip to main content
Glama
study-flamingo

D&D MCP Server

get_campaign_info

Retrieve details about your current Dungeons & Dragons campaign, including characters, quests, locations, and session information for campaign management.

Instructions

Get information about the current campaign.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The core handler function for the 'get_campaign_info' tool. Decorated with @mcp.tool for automatic registration. Retrieves the current campaign from storage, compiles key statistics, and returns a formatted markdown string with campaign details.
    @mcp.tool
    def get_campaign_info() -> str:
        """Get information about the current campaign."""
        campaign = storage.get_current_campaign()
        if not campaign:
            return "No active campaign."
    
        info = {
            "name": campaign.name,
            "description": campaign.description,
            "dm_name": campaign.dm_name,
            "setting": campaign.get_setting(),
            "character_count": len(campaign.characters),
            "npc_count": len(campaign.npcs),
            "location_count": len(campaign.locations),
            "quest_count": len(campaign.quests),
            "session_count": len(campaign.sessions),
            "current_session": campaign.game_state.current_session,
            "current_location": campaign.game_state.current_location,
            "party_level": campaign.game_state.party_level,
            "in_combat": campaign.game_state.in_combat
        }
    
        return f"**Campaign: {campaign.name}**\n\n" + \
               "\n".join([f"**{k.replace('_', ' ').title()}:** {v}" for k, v in info.items()])
  • The @mcp.tool decorator registers the get_campaign_info function as an MCP 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