JSON <-> Clojure data codec for the JSON-RPC boundary. Lives in shell so cheshire (an I/O-adjacent dependency) stays out of the functional core.
JSON <-> Clojure data codec for the JSON-RPC boundary. Lives in shell so cheshire (an I/O-adjacent dependency) stays out of the functional core.
(decode line)Parse one JSON-RPC line into a Clojure map with keyword keys. Returns nil for blank input. Throws on malformed JSON (the caller maps that to a JSON-RPC parse error).
Keys are keywordized so the core reads protocol/tool fields idiomatically.
Keyword interning from untrusted input is bounded at runtime: Clojure's
keyword table holds weak references and clears stale entries, so transient
keys from peer input are reclaimed by GC. If a non-local transport (HTTP/SSE,
multiple/untrusted peers) is added, revisit this — keep tool :arguments
string-keyed there to remove the interning surface entirely.
Parse one JSON-RPC line into a Clojure map with keyword keys. Returns nil for blank input. Throws on malformed JSON (the caller maps that to a JSON-RPC parse error). Keys are keywordized so the core reads protocol/tool fields idiomatically. Keyword interning from untrusted input is bounded at runtime: Clojure's keyword table holds weak references and clears stale entries, so transient keys from peer input are reclaimed by GC. If a non-local transport (HTTP/SSE, multiple/untrusted peers) is added, revisit this — keep tool `:arguments` string-keyed there to remove the interning surface entirely.
(encode message)Serialize a JSON-RPC message map to a single-line JSON string.
Serialize a JSON-RPC message map to a single-line JSON string.
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 |