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

Method close

src/server/stdio.ts:64–80  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

62 }
63
64 async close(): Promise<void> {
65 // Remove our event listeners first
66 this._stdin.off('data', this._ondata);
67 this._stdin.off('error', this._onerror);
68
69 // Check if we were the only data listener
70 const remainingDataListeners = this._stdin.listenerCount('data');
71 if (remainingDataListeners === 0) {
72 // Only pause stdin if we were the only listener
73 // This prevents interfering with other parts of the application that might be using stdin
74 this._stdin.pause();
75 }
76
77 // Clear the buffer and notify closure
78 this._readBuffer.clear();
79 this.onclose?.();
80 }
81
82 send(message: JSONRPCMessage): Promise<void> {
83 return new Promise(resolve => {

Callers

nothing calls this directly

Calls 2

clearMethod · 0.80
oncloseMethod · 0.80

Tested by

no test coverage detected