I Just Wanted to Play D&D: How a Weekend of Fun Turned Into Building Two Tools

Building BeringAssistant
Photo by Tammy Walters

What started as “let me do something fun with AI this weekend” became a DM skill, a RAG pipeline, an MCP server in Rust, and a genuinely useful toolchain I didn’t know I was going to build.


The Setup: I Wanted to Play, Not Learn

I spend a lot of time with AI in a professional context: reading about agents, experimenting with tooling, thinking about architecture. It is useful, but lately it has all felt like sharpening tools I never actually get to swing. I wanted to stop practicing and start playing.

This past weekend I wanted something different. I wanted to actually use AI for something I enjoy, not as a subject of study but as a tool for fun. I decided to use an AI agent to run a D&D campaign.

That’s it. That was the whole plan. Roll some dice, explore a dungeon, fight some goblins.

What actually happened was I built two interconnected tools, learned how to write AI Agent skills from scratch, built a RAG pipeline with local embeddings, and shipped an MCP server in Rust. In a weekend. While having a genuinely great time the whole way through.


Step One: The DM Skill

Claude knows D&D. Any model trained on a few years of internet data has absorbed a massive amount of 5e content: rules, lore, character options, monsters. If you just open a conversation and say “be my Dungeon Master,” it does a pretty decent job.

But “decent” starts to fray when you get specific. Ask it exactly how grappling works. Ask it for the precise cost of plate armor. Ask it what a Beholder’s legendary actions are in order. The model will give you an answer, but the answer will sometimes be close, sometimes paraphrased, sometimes just invented with complete confidence. If you care about playing the game correctly, or if you want to hand narrative control to the AI and actually trust it, “I think I remember” isn’t good enough.

The first thing I built was a skill: dnd5e-dm. AI Agent skills are markdown files with a YAML frontmatter header that describe who the AI is and how to behave. The SKILL.md file becomes the AI’s operating instructions for that mode. I wrote one that told Claude exactly how to run a 5e campaign: how to track initiative, maintain a session state block, adjudicate rolls, build NPCs with wants and fears and secrets, generate dungeons procedurally, and pace the narrative.

I also wrote a parallel skill, dnd5e-solo, for when I want to play my own character while Claude runs the world and plays companion characters alongside me. One skill for DM mode, one for co-op mode.

The reference files go deep. Combat procedures. NPC voice archetypes. Encounter design using Matt Colville’s action-oriented boss method. Narrative pacing modeled on how Matt Mercer and Brennan Lee Mulligan handle dramatic beats. Procedural tables for dungeons, settlements, loot, weather.

And then I played with it. And it was great. The narration was vivid, the NPCs felt alive, the combat had stakes. I was having exactly the kind of fun I wanted.


The Gap

About three sessions in, I started noticing the edges.

The AI would narrate a spell correctly nine times out of ten. Then it would describe Misty Step as a 30-foot teleport when it’s actually 30 feet (it got that right, actually), but it would misremember a concentration rule, or get a monster’s damage dice slightly wrong, or invent a class feature that doesn’t exist.

The skill had a principle baked into it: “Look it up, don’t guess.” But there was nothing to look up from. The instruction was aspirational. The sourcebooks existed on my shelf and as PDFs on my hard drive, not anywhere the AI could actually access.

I sat with this for a bit and thought: what would it actually take to fix this? Not work around it. Fix it.

The answer was pretty clear. I needed to:

  1. Get the text out of my PDFs
  2. Turn that text into something searchable
  3. Expose the search as a tool Claude could call mid-session

That’s a RAG pipeline. That’s a project. I wasn’t planning to build it this weekend.

I built it anyway.


Step Two: The RAG MCP Server

The result is dnd-rag-mcp, a Rust binary with two modes: index and serve.

Indexing walks a directory of PDFs and runs them through a pipeline:

PDF files → text extraction → overlapping chunks → local embeddings → SQLite

Text comes out via pdf-extract. Chunks are ~1000 characters with 200-character overlap so that rules that span a page boundary don’t lose their context. Embeddings come from the BGE-small-en-v1.5 model running locally via fastembed and ONNX Runtime. No API keys, no cloud, everything on my machine. The 384-dimensional vectors go into SQLite alongside the chunk text and source metadata.

Serving starts an MCP server on stdio. AI Agent sends a query, the server embeds it with the same model, runs cosine similarity against every vector in the database, and returns the top results with source attribution. Book name, page range, exact text.

The search itself is almost embarrassingly simple:

fn cosine_similarity(a: &[f32], b: &[f32]) -> f32 {
    let dot: f32 = a.iter().zip(b.iter()).map(|(x, y)| x * y).sum();
    let norm_a: f32 = a.iter().map(|x| x * x).sum::<f32>().sqrt();
    let norm_b: f32 = b.iter().map(|x| x * x).sum::<f32>().sqrt();
    dot / (norm_a * norm_b)
}

Brute-force over every vector in the database. No approximate nearest neighbors. No HNSW graph. For ~15,000 chunks from 20 books, this runs in about 5ms. I was prepared to optimize. I never needed to.

The MCP layer is equally clean. The rmcp crate gives you macros that generate the protocol scaffolding from annotated structs:

#[tool_router]
impl DndRagServer {
    #[tool(description = "Search through indexed D&D 5e books and documents.")]
    async fn search_dnd_books(
        &self,
        Parameters(params): Parameters<SearchParams>,
    ) -> Result<CallToolResult, McpError> {
        // embed, search, return passages
    }
}

Define a struct, add some macros, return a result. The protocol handling (the JSON-RPC initialization handshake, the tools/list response, the tools/call dispatch) is all generated. The server entry point is three lines:

let server = DndRagServer::new(db_path)?;
let service = server.serve(stdio()).await?;
service.waiting().await?;

Then one config block in ~/.claude/settings.json to register it, and now every conversation has access to search_dnd_books and list_indexed_sources.


How the Two Projects Connect

This is the part that satisfies me most. The skill and the MCP server aren’t separate projects that happen to be in the same repo. They were designed for each other.

The DM skill has always had this instruction in it:

“Look it up, don’t guess. Always search the indexed sourcebooks before citing rules, stats, descriptions, or prices. Never rely on memory alone when the books are available.”

When I first wrote that, it was aspirational. There were no books to search. The instruction was there because that’s how a real DM operates. They have the books open on the table. But I didn’t have the tool to back it up yet.

The MCP server is exactly that tool. Now when the skill says to search before stating a rule, it actually can. The instruction became real.

The workflow looks like this now:

Player: “I want to grapple the orc and shove it into the pit.”

DM (internally): search: “grappling shove rules 5e” → retrieves exact PHB text about the Grapple action, contested Athletics checks, the Shove variant, movement reduction

DM: “Bold move. Roll an Athletics check. The orc contests with Athletics or Acrobatics. If you beat it, you’ve got it grappled. Then you can use your bonus action to attempt the shove, same contested check, and if you win, it goes prone or moves 5 feet in a direction of your choice. Into the pit counts.”

Instead of “I think that’s right,” it’s “here’s what the book says.” The game plays better. The trust is higher.


What I Actually Learned

I was trying to have fun. I ended up learning a lot anyway, but the learning happened through the fun, not instead of it. That’s a different texture.

On tool creation: I’ve used MCP servers. I’d never built one from scratch. The protocol is actually pretty simple once you strip away the abstraction. It’s JSON-RPC over stdio, with a handshake and a tool registry. The rmcp macros make the Rust implementation clean enough that the interesting part is your tool logic, not the protocol plumbing. Building my own gave me a mental model I didn’t have before.

On RAG: I’d read a lot about retrieval-augmented generation. Building one for a concrete use case is different from reading about it. The questions that felt theoretical (chunk size, overlap strategy, embedding model choice, storage backend) all became practical. I made choices, tested them, saw what worked. BGE-small is good enough. SQLite is good enough. 1000 characters with 200 overlap is good enough. “Good enough” is a legitimate engineering answer.

On skills: Writing a skill is an act of encoding expertise. When I was writing the DM skill’s reference files (the combat procedures, the NPC voice archetypes, the encounter design principles) I was essentially writing a book on how to run a good D&D session. The process of writing it forced me to articulate things I’d absorbed from years of playing and watching actual play. That’s useful independent of the AI.

On the feedback loop between fun and building: The reason the RAG server got built is because I hit a real problem while doing something I enjoyed. I wasn’t looking for a project. The project found me because the thing I was playing with had an obvious gap. That’s a different motivational structure than “I should learn about RAG.” The result was better because I cared about the outcome, not the technique.


The Weekend I Didn’t Plan to Have

I wanted to roll dice and fight goblins. I did that. I also shipped two tools that solve a real problem and that I’ll keep using.

I think there’s something worth sitting with here. The AI development community spends a lot of energy on learning methodologies: tutorials, courses, structured experiments. That’s all legitimate. But there’s another path: pick something you actually enjoy, try to use AI for it, notice what’s broken, fix the broken thing. The learning comes along for free.

This weekend I wasn’t studying MCP. I was playing D&D and got annoyed that my AI DM kept misremembering spell rules. The MCP server was the fix for a real annoyance, not an exercise in a curriculum.

The distinction matters. The fix actually works. I’ll keep using it. And now I know how to build one.


dnd-skill/ - the AI Agent skills (DM and solo modes) with reference files dnd-rag-mcp/ - the Rust MCP server with RAG pipeline (~400 lines of code) Built on a weekend. Still running.