MCPcopy Create free account
hub / github.com/modelcontextprotocol/typescript-sdk / readMessage

Method readMessage

src/shared/stdio.ts:13–26  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

11 }
12
13 readMessage(): JSONRPCMessage | null {
14 if (!this._buffer) {
15 return null;
16 }
17
18 const index = this._buffer.indexOf('\n');
19 if (index === -1) {
20 return null;
21 }
22
23 const line = this._buffer.toString('utf8', 0, index).replace(/\r$/, '');
24 this._buffer = this._buffer.subarray(index + 1);
25 return deserializeMessage(line);
26 }
27
28 clear(): void {
29 this._buffer = undefined;

Callers 3

stdio.test.tsFile · 0.80
processReadBufferMethod · 0.80
processReadBufferMethod · 0.80

Calls 2

deserializeMessageFunction · 0.85
toStringMethod · 0.80

Tested by

no test coverage detected