gleamunison/mcp_session
MCP session layer: a live gleamunison session behind the JSON-RPC tools.
The session is immutable after boot: eval is read-only (define forms are
rejected), so handlers never thread state. Tools answer from the session’s
own definition table — names, kinds, content-addressed refs.
Types
One search hit: the triple a CLI or an agent actually needs.
pub type SearchHit {
SearchHit(name: String, kind: String, ref_hex: String)
}
Constructors
-
SearchHit(name: String, kind: String, ref_hex: String)
pub opaque type SessionState
Values
pub fn handle_rpc(
state: SessionState,
body: String,
) -> mcp.Response
Route one JSON-RPC body through the protocol layer with the session’s real tools attached.
pub fn load_file(
state: SessionState,
path: String,
) -> Result(SessionState, String)
Extend a session by loading a lisp source file through the same
pipeline verify uses: defines are defined, other forms evaluated.
pub fn search(
state: SessionState,
query: String,
) -> List(SearchHit)
Substring search over definition names and bodies. Name matches rank above body-only matches; alphabetical inside groups.