MCPcopy Index your code
hub / github.com/modelcontextprotocol/python-sdk / receive

Method receive

tests/client/test_stdio.py:104–113  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

102 self._on_receive = on_receive
103
104 async def receive(self) -> bytes:
105 try:
106 chunk = await self._inner.receive()
107 except anyio.EndOfStream:
108 if self._eof_error is not None:
109 # A hard-killed pipe surfaces a reset, not EOF, on the proactor loop.
110 raise self._eof_error from None
111 raise
112 self._on_receive()
113 return chunk
114
115 async def aclose(self) -> None:
116 await self._inner.aclose()

Calls

no outgoing calls

Tested by

no test coverage detected