Skip to main content
Glama
study-flamingo

D&D MCP Server

add_event

Log events to track combat, roleplay, exploration, quests, characters, world developments, or sessions in your D&D campaign adventure log.

Instructions

Add an event to the adventure log.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
event_typeYesType of event
titleYesEvent title
descriptionYesEvent description
session_numberNoSession number
characters_involvedNoCharacters involved in the event
locationNoLocation where event occurred
importanceNoEvent importance (1-5)
tagsNoTags for categorizing the event

Implementation Reference

  • The MCP tool handler for 'add_event' decorated with @mcp.tool (registration). Defines input schema via Annotated parameters with descriptions and validations. Constructs AdventureEvent, calls storage to persist, returns confirmation.
    @mcp.tool
    def add_event(
        event_type: Annotated[Literal["combat", "roleplay", "exploration", "quest", "character", "world", "session"], Field(description="Type of event")],
        title: Annotated[str, Field(description="Event title")],
        description: Annotated[str, Field(description="Event description")],
        session_number: Annotated[int | None, Field(description="Session number", ge=1)] = None,
        characters_involved: Annotated[list[str] | None, Field(description="Characters involved in the event")] = None,
        location: Annotated[str | None, Field(description="Location where event occurred")] = None,
        importance: Annotated[int, Field(description="Event importance (1-5)", ge=1, le=5)] = 3,
        tags: Annotated[list[str] | None, Field(description="Tags for categorizing the event")] = None,
    ) -> str:
        """Add an event to the adventure log."""
        event = AdventureEvent(
            event_type=EventType(event_type),
            title=title,
            description=description,
            session_number=session_number,
            characters_involved=characters_involved or [],
            location=location,
            importance=importance,
            tags=tags or []
        )
    
        storage.add_event(event)
        return f"Added {event_type.lower} event: '{event.title}'"
  • Pydantic BaseModel schema for AdventureEvent used by the tool for data validation and serialization.
    class AdventureEvent(BaseModel):
        """Individual event in the adventure log."""
        id: str = Field(default_factory=lambda: random(length=8))
        event_type: EventType
        title: str
        description: str
        timestamp: datetime = Field(default_factory=datetime.now)
        session_number: int | None = None
        characters_involved: list[str] = Field(default_factory=list)
        location: str | None = None
        tags: list[str] = Field(default_factory=list)
        importance: int = Field(ge=1, le=5, default=3)  # 1=minor, 5=major
  • Storage class helper method that appends the event to the internal list and saves to persistent storage.
    def add_event(self, event: AdventureEvent) -> None:
        """Add an event to the adventure log."""
        logger.info(f"➕ Adding event: '{event.title}' ({event.event_type})")
        self._events.append(event)
        self._save_events()
        logger.debug("✅ Event added and log saved.")

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