src/client.bend checks
raw source on the hub · import ezmcp@0.2.0.0/src/client.bend as Client
ezmcp/src/client: an MCP client's messages and how it reads replies, with no IO. src/io.bend POSTs them over ezhttp.
7 imports
import Base import 0xa81e161008ecc2f297c0a3065cb9b188/main.bend as Json import 0xa81e161008ecc2f297c0a3065cb9b188/src/value.bend as Value import 0x7367809738fddd234b8d2bed772ad2cf/src/http.bend as Http import ./rpc.bend as Rpc import ./server.bend as Server import ./sse.bend as Sse
Definitions
def init.params source · line 13 · raw
@name:String -> @version:String -> 0xa81e161008ecc2f297c0a3065cb9b188/src/value.Json
the params of initialize: the latest revision, no client capabilities, and the client's name and version (basic/lifecycle#initialization)
def initialize source · line 20 · raw
@id:0xa81e161008ecc2f297c0a3065cb9b188/src/value.Json -> @name:String -> @version:String -> 0xa81e161008ecc2f297c0a3065cb9b188/src/value.Json
the initialize request
def initialized source · line 24 · raw
0xa81e161008ecc2f297c0a3065cb9b188/src/value.Json
the notification a client sends once initialize succeeded
def tools source · line 28 · raw
@id:0xa81e161008ecc2f297c0a3065cb9b188/src/value.Json -> 0xa81e161008ecc2f297c0a3065cb9b188/src/value.Json
a tools/list request
def call source · line 32 · raw
@id:0xa81e161008ecc2f297c0a3065cb9b188/src/value.Json -> @name:String -> @args:0xa81e161008ecc2f297c0a3065cb9b188/src/value.Json -> 0xa81e161008ecc2f297c0a3065cb9b188/src/value.Json
a tools/call request
def headers source · line 38 · raw
@+version:String -> List<&2, 0x7367809738fddd234b8d2bed772ad2cf/src/http.Header>
the headers of every POST: a JSON body, both reply types accepted, and the negotiated revision once there is one (empty before initialize)
def is.sse source · line 47 · raw
@+ctype:String -> Bool
whether a Content-Type is an event stream
def body source · line 51 · raw
@sse:Bool -> @+text:String -> String
a reply body's JSON text: an event stream's last data, else the body
def took.ok source · line 58 · raw
@+ctype:String -> @text:String -> @ok:Bool -> @+status:U32 -> 0x6b75cc24ae78878f45f867de73d7929d/src/rpc.Reply
def took source · line 67 · raw
@+status:U32 -> @ctype:String -> @text:String -> 0x6b75cc24ae78878f45f867de73d7929d/src/rpc.Reply
what an HTTP reply to a request says: a 200 is read as JSON or as an event stream by its Content-Type; any other status is unread
def accepted source · line 71 · raw
@+status:U32 -> Bool
whether an HTTP reply to a notification accepted it: any 2xx
def version source · line 75 · raw
@result:0xa81e161008ecc2f297c0a3065cb9b188/src/value.Json -> String
the revision an initialize result names, "" when it names none