ds mcp#
Server#
Command#
ds mcp [-L DIR]... [--root DIR]... [--out DIR] [--calls SOCK [--call-timeout SECONDS]]
ds mcp is an MCP server on stdin and stdout.
Option |
Value |
Effect |
|---|---|---|
|
a directory |
a library directory for every load; accumulates |
|
a directory |
a directory to read under; accumulates |
|
a directory |
the directory to write under |
|
a socket path |
sends each call to a responder on this socket |
|
seconds, |
how long a round of calls waits for replies; default |
|
none |
the usage on stdout, exit |
The exit status is 0 once the input ends. A socket that cannot be opened is exit 4.
(Source: tools/dsdb/lib/cli/main.js, tools/dsdb/lib/mcp/server.js)
Protocol#
JSON-RPC 2.0, one message per line, one client and one session, handled in order. Batches are refused.
Method |
Result |
|---|---|
|
capabilities |
|
|
|
each tool, with its input and output schema |
|
|
|
The protocol revision is the client’s where it is 2025-11-25 or 2025-06-18, else 2025-11-25. An unknown method or tool, a malformed message and a resource that cannot be read are JSON-RPC errors.
(Source: tools/dsdb/lib/mcp/server.js)
Refusals#
A tool that refuses answers with isError true and the shell’s message.
An argument a tool does not declare is refused. Every tool but load is refused until a session is loaded.
(Source: tools/dsdb/lib/mcp/server.js, tools/dsdb/lib/api/ops.js)
Progress#
A tools/call whose _meta.progressToken is a string or a number gets notifications/progress during long work, rising across the call.
(Source: tools/dsdb/lib/mcp/server.js, tools/dsdb/lib/api/ops.js)
Confinement#
Reads and writes#
--root DIR, --out DIR
A path a client names is read only under a --root or --out, and written only under --out.
Each is the working directory when not given. A path is taken through its symbolic links first. load’s program, trace and search are refused outside, and so is a save.
A directory that is not one is a usage error. What the command line names, -L and --calls, is not confined.
(Source: tools/dsdb/lib/cli/fence.js, tools/dsdb/lib/cli/open.js)
Tools#
Points#
Tools that read take at, a point, and leave point where it is. move alone moves it.
A point is a hex position as listings print it (1aba, 1aba-), start, end, or a clock from the first record with its underscore (12_s). Facts are named by id, and firings by rule and timetag.
(Source: tools/dsdb/lib/api/ops.js, tools/dsdb/lib/mcp/server.js)
Session#
Tool |
Arguments |
Result |
|---|---|---|
|
|
loads a |
|
none |
point’s position and clock, and whether it is settled |
|
one of |
moves point; |
|
|
lets time pass: at a live session’s end, moves its clock and pumps; at a hypothesis’s end, feeds it reality’s inputs |
(Source: tools/dsdb/lib/cli/open.js, tools/dsdb/lib/api/ops.js)
Looking#
Tool |
Arguments |
Result |
|---|---|---|
|
|
live facts per schema, with the change since the settled point before; or each schema’s population over the timeline |
|
|
one schema’s live facts, each bound to |
|
|
answers to a query: one pattern per line, and a last line |
|
|
one fact: slots, lifecycle, where it began and ended, versions |
|
|
firings in the cascade that led to a point, or |
|
|
one firing: matched facts and effects |
|
|
calls waiting at a point, or every call and its outcome |
|
|
the derivation tree down to the inputs |
|
|
each rule’s chain with what each node holds; or |
|
|
how far a rule matches, and where it stops |
|
|
a fact through the network’s alpha tests |
|
|
the record listing, |
schema and rule in population, firings and rete are regular expressions over names. A library schema is named by its own name.
(Source: tools/dsdb/lib/api/ops.js)
Timelines#
Tool |
Arguments |
Result |
|---|---|---|
|
none |
|
|
|
makes a timeline current |
|
none |
a new hypothesis at point, made current |
|
|
closes a hypothesis |
|
|
writes a timeline as a trace file |
|
none |
the current timeline’s changes at a point |
(Source: tools/dsdb/lib/api/ops.js)
Changes at point#
from is where the change is made: here (the default), start, end, or a point. Point moves there first. A change lands as the shell’s does.
Tool |
Arguments |
Result |
|---|---|---|
|
|
asserts an input and runs to quiescence; |
|
|
retracts a live fact; from a point before its assert, its input never happens |
|
|
replies to a call; |
|
|
fails a call, as a |
|
|
drops an answered call’s recorded reply, in a fork |
(Source: tools/dsdb/lib/api/ops.js)
Program#
An edit applies as the shell’s does.
Tool |
Arguments |
Result |
|---|---|---|
|
|
adds one definition, or replaces the one of its kind and name; nothing changes if it does not compile. A new rule goes last in the rule order |
|
|
removes a definition; |
|
|
moves a rule in the rule order |
|
|
definitions by kind; |
|
|
one definition’s text |
|
|
writes the program to one file |
(Source: tools/dsdb/lib/api/ops.js)
Calls responder#
--calls SOCK
With --calls, each call at a live session’s end goes to the responder when a tool ends.
Lines are the calls socket’s. Replies within --call-timeout are made together, in call order, as from_here_answer and from_here_fail, and the same holds for the calls those make. A call to a no response service is sent and is not waited for. With no reply in time, the calls stay waiting, and a tool answers them. Anywhere but a live session’s end, tools answer.
(Source: tools/dsdb/lib/api/ops.js)
Result bounds#
Rows#
limit, cursor
A tool with rows returns at most limit, default 50, then a more result with how many are left and a cursor for them.
facts, query, firings, calls, rete, listing and ls are bounded so. The other arguments stay as before when a cursor is given.
(Source: tools/dsdb/lib/api/bound.js, tools/dsdb/lib/api/ops.js)
Trees#
depth, nodes
why stops after depth firing levels, or nodes numbered nodes, default 200.
A fact or firing marked … has more below it, and why on it goes on.
(Source: tools/dsdb/lib/api/bound.js, tools/dsdb/lib/api/ops.js)
Resources#
Listing#
Nothing is listed until something is loaded. notifications/resources/list_changed follows a load, a fork or a kill. All are text/plain.
URI |
Contents |
|---|---|
|
the program’s text, as |
|
the rules in firing order, each with its first pattern and its firings up to point |
|
|
|
every record of timeline |
A resource that cannot be read is JSON-RPC error -32002.
(Source: tools/dsdb/lib/api/resources.js, tools/dsdb/lib/mcp/server.js)