Skip to main content
Glama

add_session_note

Track and organize Dungeons & Dragons session details by adding notes, including summaries, key events, characters present, experience gained, and treasure found, ensuring comprehensive campaign management.

Instructions

Add notes for a game session.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
characters_presentNoCharacters present in session
eventsNoKey events that occurred
experience_gainedNoExperience points gained
notesNoAdditional notes
session_numberYesSession number
summaryYesSession summary
titleNoSession title
treasure_foundNoTreasure or items found

Implementation Reference

  • The primary handler function for the 'add_session_note' MCP tool, decorated with @mcp.tool for automatic registration. Defines input schema via Annotated parameters with Pydantic Field descriptions and constraints. Implements logic by instantiating SessionNote model and persisting via storage.
    @mcp.tool def add_session_note( session_number: Annotated[int, Field(description="Session number", ge=1)], summary: Annotated[str, Field(description="Session summary")], title: Annotated[str | None, Field(description="Session title")] = None, events: Annotated[list[str] | None, Field(description="Key events that occurred")] = None, characters_present: Annotated[list[str] | None, Field(description="Characters present in session")] = None, experience_gained: Annotated[int | None, Field(description="Experience points gained", ge=0)] = None, treasure_found: Annotated[list[str] | None, Field(description="Treasure or items found")] = None, notes: Annotated[str, Field(description="Additional notes")] = "", ) -> str: """Add notes for a game session.""" session_note = SessionNote( session_number=session_number, title=title, summary=summary, events=events or [], characters_present=characters_present or [], experience_gained=experience_gained, treasure_found=treasure_found or [], notes=notes ) storage.add_session_note(session_note) return f"Added session note for Session {session_note.session_number}"
  • Pydantic BaseModel defining the SessionNote data structure, which matches the tool's input parameters. Provides validation and serialization for session notes.
    class SessionNote(BaseModel): """Session notes and summary.""" id: str = Field(default_factory=lambda: random(length=8)) session_number: int date: datetime = Field(default_factory=datetime.now) title: str | None = None summary: str events: list[str] = Field(default_factory=list) characters_present: list[str] = Field(default_factory=list) experience_gained: int | None = None treasure_found: list[str] = Field(default_factory=list) notes: str = ""
  • Helper method in the DnDStorage class that appends the provided SessionNote to the current campaign's sessions list, updates timestamps, and persists the campaign data to storage.
    def add_session_note(self, session_note: SessionNote) -> None: """Add a session note.""" if not self._current_campaign: raise ValueError("No current campaign") self._current_campaign.sessions.append(session_note) self._current_campaign.updated_at = datetime.now() self._save_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