* 发送响应
(clientId: string, messageId: any, result: any)
| 403 | * 发送响应 |
| 404 | */ |
| 405 | private sendResponse(clientId: string, messageId: any, result: any): void { |
| 406 | const response: MCPMessage = { |
| 407 | jsonrpc: '2.0', |
| 408 | id: messageId, |
| 409 | result, |
| 410 | }; |
| 411 | |
| 412 | if (clientId === 'stdio') { |
| 413 | process.stdout.write(JSON.stringify(response) + '\n'); |
| 414 | } else { |
| 415 | const client = this.clients.get(clientId); |
| 416 | if (client) { |
| 417 | client.send(JSON.stringify(response)); |
| 418 | } |
| 419 | } |
| 420 | } |
| 421 | |
| 422 | /** |
| 423 | * 发送错误 |
no test coverage detected