refactor: Improve logging and error handling in MCPApiService and ClaudeCodeService

This commit is contained in:
Vaayne
2025-09-23 14:31:56 +08:00
parent 305a454ffd
commit 98ebfd12b3
3 changed files with 21 additions and 17 deletions
-5
View File
@@ -102,19 +102,14 @@ class MCPApiService extends EventEmitter {
async getServerInfo(id: string): Promise<any> {
try {
logger.silly(`getServerInfo called with id: ${id}`)
const server = await this.getServerById(id)
if (!server) {
logger.warn(`Server with id ${id} not found`)
return null
}
logger.silly(`Returning server info for id ${id}`)
const client = await mcpService.initClient(server)
const tools = await client.listTools()
logger.silly(`Server with id ${id} info:`, { tools: JSON.stringify(tools.tools) })
return {
id: server.id,
name: server.name,