JSON-RPC dispatch for MCP.
Takes a parsed request map, returns a response map. No I/O and no transport concerns — which is what makes it testable without a socket.
JSON-RPC dispatch for MCP. Takes a parsed request map, returns a response map. No I/O and no transport concerns — which is what makes it testable without a socket.
(admit {:keys [connection] :as ctx} payload)Give each request a cancellation record. Legacy connections also index
their records for notifications; a request without a connection keeps
its record to itself, where no notice can name it — on the stateless
wire the request's own stream is what cancels it (on-stream-close).
Give each request a cancellation record. Legacy connections also index their records for notifications; a request without a connection keeps its record to itself, where no notice can name it — on the stateless wire the request's own stream is what cancels it (`on-stream-close`).
(configure! opts)Adopt init!'s teaching-surface options. Called before the port opens,
so no client ever connects without them.
Adopt `init!`'s teaching-surface options. Called before the port opens, so no client ever connects without them.
(dismiss {:keys [connection] :co.multiply.remontoire.mcp/keys [requests]})Remove this admission's records from the connection's notification index.
Remove this admission's records from the connection's notification index.
(handle-modern message ctx)One stateless-wire message, already past the transport's header checks. Returns the response, or nil for a notification.
One stateless-wire message, already past the transport's header checks. Returns the response, or nil for a notification.
(handle-payload payload)(handle-payload payload ctx)A parsed request body on the legacy wire — one message or a batch of them. Returns the response payload, or nil when nothing in the batch warrants a reply.
A parsed request body on the legacy wire — one message or a batch of them. Returns the response payload, or nil when nothing in the batch warrants a reply.
(on-stream-close ctx id)Make request id of ctx one that its response stream cancels, and
return what the transport calls when a write to that stream fails
before the response has gone out. For the stateless wire, where a
client cancels by closing the stream and sends no notice (the
2026-07-28 HTTP binding; measured 2026-11-23) — so a timeout or a lost
connection cancels too, the server being unable to tell them from a
stop (§5).
Make request `id` of `ctx` one that its response stream cancels, and return what the transport calls when a write to that stream fails before the response has gone out. For the stateless wire, where a client cancels by closing the stream and sends no notice (the 2026-07-28 HTTP binding; measured 2026-11-23) — so a timeout or a lost connection cancels too, the server being unable to tell them from a stop (§5).
(probe)The sessionless identity GET /probe serves: who answers here, minting
nothing. :server is the fixed discriminator discovery tooling keys on;
:version reads server-info — a site the release checklist already
syncs, so no fifth version location; :describe is the init!-time
self-description, nil when unset. Consumers key on field presence, not
shape completeness — fields may accrete here without coordination.
The sessionless identity `GET /probe` serves: who answers here, minting nothing. `:server` is the fixed discriminator discovery tooling keys on; `:version` reads `server-info` — a site the release checklist already syncs, so no fifth version location; `:describe` is the `init!`-time self-description, nil when unset. Consumers key on field presence, not shape completeness — fields may accrete here without coordination.
The stateless revision this server speaks beside the legacy handshake.
The stateless revision this server speaks beside the legacy handshake.
(task-here? task-id)Whether task-id names a task this JVM's registry holds.
Whether `task-id` names a task this JVM's registry holds.
(tool-refusal {:keys [id method]} modern? message)The response to payload — a request, on the wire modern? says — that
a tool call would give when it refuses in its own words: an isError
result for a tools/call, a JSON-RPC error for anything else. For a
caller that answers a request without dispatching it.
The response to `payload` — a request, on the wire `modern?` says — that a tool call would give when it refuses in its own words: an `isError` result for a `tools/call`, a JSON-RPC error for anything else. For a caller that answers a request without dispatching it.
The tool table. Each entry is its own MCP declaration plus a :handler, which is stripped before the entry is sent to the client.
The tool table. Each entry is its own MCP declaration plus a :handler, which is stripped before the entry is sent to the client.
(tools-changed? cid)Whether the tool set differs from what connection cid last fetched.
Deliberately "last fetched", not "last announced": a lost
announcement re-announces on the next stream, and a client holding a
list from a previous server run is told to refresh on its first call —
the marker only advances when a tools/list actually serves the
current set (§4). The transport asks before closing each response
stream on the wire that has connections and announces
tools/list_changed while the answer is yes — the client re-fetches
promptly (measured 2026-08-04, claude-code 2.1.220), which is what
makes a reloaded tool table reach a live client without a reconnect.
The stateless wire has ttlMs on the list itself instead.
Whether the tool set differs from what connection `cid` last fetched. Deliberately "last fetched", not "last announced": a lost announcement re-announces on the next stream, and a client holding a list from a previous server run is told to refresh on its first call — the marker only advances when a `tools/list` actually serves the current set (§4). The transport asks before closing each response stream on the wire that has connections and announces `tools/list_changed` while the answer is yes — the client re-fetches promptly (measured 2026-08-04, claude-code 2.1.220), which is what makes a reloaded tool table reach a live client without a reconnect. The stateless wire has `ttlMs` on the list itself instead.
(waiting connection id)How many requests in flight here a cancellation notice for request
id, arriving on connection, names.
How many requests in flight here a cancellation notice for request `id`, arriving on `connection`, names.
(with-admission ctx payload f)Call f with the requests in payload registered for cancellation.
The outermost call owns the records. HTTP wraps dispatch and the
response write so a cancellation can still arrive during the write.
A direct dispatcher call owns its records until it returns.
Call `f` with the requests in `payload` registered for cancellation. The outermost call owns the records. HTTP wraps dispatch and the response write so a cancellation can still arrive during the write. A direct dispatcher call owns its records until it returns.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |