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,
    score: Float,
  )
}

Constructors

  • SearchHit(
      name: String,
      kind: String,
      ref_hex: String,
      score: Float,
    )
pub opaque type SessionState

Values

pub fn boot() -> SessionState

Fresh session: bootstrap (genesis) definitions only.

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)

BM25-ranked search over definition names and bodies. Name tokens count double (a name match is stronger intent evidence than a body mention). Ties break alphabetically for stable output.

✨ Search Document