Liking cljdoc? Tell your friends :D

Initialize-era clients

presa serves MCP 2026-07-28 by default. The older revisions, 2025-11-25 and 2025-06-18, start with an initialize handshake and keep a session; some hosts still speak only those (Codex 0.165.0 sends initialize with 2025-06-18; see hosts.md). List them in :versions to serve them too:

(require '[presa.client :as client]
         '[presa.protocol :as protocol]
         '[presa.server :as server])

(def srv (server/server {:name "both" :version "1"
                         :versions protocol/versions   ; 2026-07-28, 2025-11-25, 2025-06-18
                         :tools [{:name "era" :description "The caller's revision"
                                  :handler (fn [_ ctx] (:version ctx))}]}))

(def c (client/connect (client/in-process srv) {:versions ["2025-06-18"]}))

(client/text (client/call-tool c "era"))
;; => "2025-06-18"

(client/close c)

initialize answers with the requested revision when the server serves it, else with the newest initialize-era one it serves. What differs from 2026-07-28 on such a session:

2026-07-28initialize era
version and capabilitiesin each request's _metaonce, in initialize
ping, logging/setLevelremoved (-32601)served (logging/setLevel with :logging)
resultType, ttlMs, cacheScope, result _meta.serverInfoon resultsabsent
input from the clientinput_required resultsrequests from server to client, inside the call
subscriptionssubscriptions/listenlist changes for the whole session with :list-changed; resources/subscribe with :subscribe
tools whose schemas are not objectslistedhidden, and refused
HTTP errorsstatuses by code200
HTTP sessionnoneMcp-Session-Id, GET stream, DELETE
Taskswith :tasksnot available; tools run synchronously

A handler written once serves both: server/input-required becomes an input_required result or a request to the client, and log! follows the request's level or the session's.

Can you improve this documentation?Edit on GitHub

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
←Move to previous article
→Move to next article
Ctrl+/Jump to the search field
× close