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

Function _line

tests/client/test_stdio.py:217–219  ·  view source on GitHub ↗

The wire form of `message`: one JSON document on its own line.

(message: JSONRPCMessage)

Source from the content-addressed store, hash-verified

215
216
217def _line(message: JSONRPCMessage) -> bytes:
218 """The wire form of `message`: one JSON document on its own line."""
219 return (message.model_dump_json(by_alias=True, exclude_unset=True) + "\n").encode()
220
221
222async def _next_message(read_stream: ReadStream[SessionMessage | Exception]) -> JSONRPCMessage:

Calls

no outgoing calls

Tested by

no test coverage detected