MCPcopy Create free account
hub / github.com/echoVic/blade-code / responseHandler

Method responseHandler

src/mcp/client/MCPClient.ts:213–229  ·  view source on GitHub ↗
(data: Buffer)

Source from the content-addressed store, hash-verified

211 } else {
212 // Handle stdio connection
213 const responseHandler = (data: Buffer) => {
214 try {
215 const response = JSON.parse(data.toString().trim());
216 if (response.id === message.id) {
217 clearTimeout(timeout);
218 connection.stdout?.off('data', responseHandler);
219
220 if (response.error) {
221 reject(new Error(response.error.message));
222 } else {
223 resolve(response.result);
224 }
225 }
226 } catch (error) {
227 // Ignore JSON parse errors for partial messages
228 }
229 };
230 connection.stdout?.on('data', responseHandler);
231 connection.stdin?.write(JSON.stringify(message) + '\n');
232 }

Callers

nothing calls this directly

Calls 1

offMethod · 0.45

Tested by

no test coverage detected