MCPcopy
hub / github.com/msgspec/msgspec / request

Method request

examples/asyncio-kv/kv.py:144–152  ·  view source on GitHub ↗

Send a request and await the response

(self, req)

Source from the content-addressed store, hash-verified

142 await self.writer.wait_closed()
143
144 async def request(self, req):
145 """Send a request and await the response"""
146 # Encode and send the request
147 buffer = msgspec.msgpack.encode(req)
148 await prefixed_send(self.writer, buffer)
149
150 # Receive and decode the response
151 buffer = await prefixed_recv(self.reader)
152 return msgspec.msgpack.decode(buffer)
153
154 async def get(self, key: str) -> str | None:
155 """Get a key from the KV store, returning None if not present"""

Callers 4

getMethod · 0.95
putMethod · 0.95
deleteMethod · 0.95
list_keysMethod · 0.95

Calls 3

prefixed_sendFunction · 0.85
prefixed_recvFunction · 0.85
decodeMethod · 0.80

Tested by

no test coverage detected