Run a D&D dungeon crawl with an AI dungeon master
Posted on Oct 4 • Edited on Oct 4 • AI-assisted. Task: The author built a browser-based D&D 5e dungeon crawl where an AI Dungeon Master answers rules questions using Sanity Context. The workflow involves seeding SRD data into Sanity, configuring Knowledge Base and GROQ MCP endpoints, and using Claude Code agents to implement the DM logic. The system enforces citation by stripping unsourced references and prefetching data server-side to maintain accuracy.; tools: custom-built or unnamed agent. Human role: The original post does not say how a person stayed involved.; limitations: The setup requires specific Sanity tokens, including an org-level Context Viewer role, as project tokens cause 403 errors. The Knowledge Base is in beta with a cap of roughly 150 indexed documents. The author notes that the model sometimes ignored forced tool choices, requiring server-side prefetching as a workaround..
Tools
custom-built or unnamed agent
Published on Agent Work Atlas:
Overview
Posted on Oct 4 • Edited on Oct 4 • AI-assisted
Workflow
The author built a browser-based D&D 5e dungeon crawl where an AI Dungeon Master answers rules questions using Sanity Context. The workflow involves seeding SRD data into Sanity, configuring Knowledge Base and GROQ MCP endpoints, and using Claude Code agents to implement the DM logic. The system enforces citation by stripping unsourced references and prefetching data server-side to maintain accuracy.
Reported result
The author reports that rules answers return in approximately 1.3–2.2 seconds. The Knowledge Base successfully identified six edition mix-ups between 2014 and 2024 rules, flagging them as conflicts. No broader business metrics or user engagement data are provided in the source.
Human role
The original post does not say how a person stayed involved.
Limitations
The setup requires specific Sanity tokens, including an org-level Context Viewer role, as project tokens cause 403 errors. The Knowledge Base is in beta with a cap of roughly 150 indexed documents. The author notes that the model sometimes ignored forced tool choices, requiring server-side prefetching as a workaround.
Try it
I want to build a D&D 5e rules assistant using Sanity Context and an LLM. First, create a Sanity project and deploy schemas for rules, conditions, spells, and monsters. Seed the dataset with SRD 5.2.1 and 5.1 data using deterministic IDs. Configure two Context MCP endpoints: one for GROQ queries (exact stats) and one for Knowledge Base search (prose rules). Use an org-level Context Viewer token for authentication. Implement a server-side prefetch strategy that runs KB and GROQ lookups in parallel before the LLM generates a response. Ensure the LLM (e.g., DeepSeek V4.1 Flash) only cites documents returned by these lookups, stripping any unsourced citations. Test with a sample query like 'What does Prone do?' and verify the response includes a trace panel showing the lookup mode, query, and cited docs. Confirm latency is under 2 seconds and that edition differences (2014 vs 2024) are flagged. Do not proceed to full game integration until this rules engine is validated.
Source reports are not independently verified. Publication date is the catalog publication date, not the original article date.