D&D 5e Rules SDK
以下摘录自该仓库的 README(片段) · 在 GitHub 读完整 README →
An executable, formally specified implementation of D&D 5e SRD 5.2.1 rules
for character creation, progression, character sheets, and combat.
Supports every SRD class and its abilities through
level 10, within the
documented runtime and table-adjudication boundaries.
The shipped SRD catalog
contains only SRD 5.2.1 content. Closed-license content is not included; the
architecture separates authored content from reusable rule procedures so that
separately supplied closed-license content can build on the same foundation.
The current public catalog builders accept SRD collections; additional mechanics
must pass the owning runtime's admission boundary or receive new procedure
support. See content architecture.
How it works
Rules have formal models in Quint and are executed by
TypeScript reducers.
The engine tells your application what it needs next: character choices,
available Battle Acts, or a missing input such as a target or roll result.
When a rule depends on a player choice or table observation, the runtime returns
a question to fill. Answering one question can reveal the next.
The core runtime does not roll dice or infer battlefield geometry. Callers provide
those facts as witnesses through the API.
A required input is a **Hole**; its answer is a **Fill**. In Battle, callers
discover **Acts**, select one, and answer the questions needed to resolve it.
See the creation workflow
and Battle protocol.
Use it
Use the SDK as the rules engine for a game, a character builder, or tools for
running encounters. Your application supplies player decisions and table facts;
the runtime applies supported mechanics and returns the next state and inputs.
Work toward implementations in other languages is in progress through the
conformance tooling, with language-neutral contracts,
formal models, and conformance tools. Availability in arbitrary languages is a
goal, not a shipped SDK promise.
The MCP server exposes these workflows to an agent,
including Play Sessions that can recover across HTTP server restarts. For
example, an illustrative interaction during an existing battle:
> **Player:** What can my fighter do?
>
> **Agent:** You can attack with your weapon. Which target?
>
> **Player:** The goblin. I'll roll at the table.
>
> **Agent:** Tell me the attack result.
>
> **Player:** 17.
>
> **Agent:** That hits. What did you roll for damage?
>
> **Player:** 8.
>
> **Agent:** The hit deals 8 damage. Here is what you can do next.
The agent discovers Acts and answers the runtime's questions through tools;
the particular choices and outcomes depend on the battle state. See
MCP usage for the tool-level flow.
For a browser view, run the character creation UI and battle visualizer.
npm packages
The SDK and stdio MCP distribution targets are @dearlordylord/dnd-sdk and
@dearlordylord/dnd-mcp. See distribution and release instructions
for package builds, verification, publication, and registry-status checks;
release notes identify unreleased changes.