Skip to main content
Glama

add_event

Log events in your Dungeons & Dragons campaign with details like type, title, description, session number, characters involved, location, importance, and tags for better tracking.

Instructions

Add an event to the adventure log.

Input Schema

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

Implementation Reference

  • The main tool handler: @mcp.tool-decorated function that parses input parameters, constructs an AdventureEvent object, and calls the storage layer to persist it. This is the primary implementation of the 'add_event' MCP tool.
    @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 model defining the structure and validation for AdventureEvent objects used by the add_event tool.
    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
  • Enum defining valid event types for the add_event tool input.
    class EventType(str, Enum): COMBAT = "combat" ROLEPLAY = "roleplay" EXPLORATION = "exploration" QUEST = "quest" CHARACTER = "character" WORLD = "world" SESSION = "session"
  • Helper method in DnDStorage class that appends the event to the in-memory event list and triggers persistence to JSON file.
    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.")
  • The @mcp.tool decorator registers the add_event 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