mirror of
https://github.com/aljazceru/opencode.git
synced 2025-12-24 11:14:23 +01:00
chore: rm debug logs
This commit is contained in:
@@ -223,11 +223,10 @@ export namespace MCP {
|
||||
}
|
||||
|
||||
const result = await withTimeout(mcpClient.tools(), mcp.timeout ?? 5000).catch((err) => {
|
||||
log.error("create() failed to get tools from client", { key, error: err })
|
||||
log.error("failed to get tools from client", { key, error: err })
|
||||
return undefined
|
||||
})
|
||||
if (!result) {
|
||||
log.info("create() tools() returned nothing, closing client", { key })
|
||||
await mcpClient.close().catch((error) => {
|
||||
log.error("Failed to close MCP client", {
|
||||
error,
|
||||
@@ -258,18 +257,14 @@ export namespace MCP {
|
||||
}
|
||||
|
||||
export async function clients() {
|
||||
const s = await state()
|
||||
log.info("clients() called", { clientCount: Object.keys(s.clients).length })
|
||||
return s.clients
|
||||
return state().then((state) => state.clients)
|
||||
}
|
||||
|
||||
export async function tools() {
|
||||
const result: Record<string, Tool> = {}
|
||||
const s = await state()
|
||||
log.info("tools() called", { clientCount: Object.keys(s.clients).length })
|
||||
const clientsSnapshot = await clients()
|
||||
for (const [clientName, client] of Object.entries(clientsSnapshot)) {
|
||||
log.info("tools() fetching tools for client", { clientName })
|
||||
const tools = await client.tools().catch((e) => {
|
||||
log.error("failed to get tools", { clientName, error: e.message })
|
||||
const failedStatus = {
|
||||
@@ -280,17 +275,14 @@ export namespace MCP {
|
||||
delete s.clients[clientName]
|
||||
})
|
||||
if (!tools) {
|
||||
log.info("tools() no tools returned for client", { clientName })
|
||||
continue
|
||||
}
|
||||
log.info("tools() got tools for client", { clientName, toolCount: Object.keys(tools).length })
|
||||
for (const [toolName, tool] of Object.entries(tools)) {
|
||||
const sanitizedClientName = clientName.replace(/[^a-zA-Z0-9_-]/g, "_")
|
||||
const sanitizedToolName = toolName.replace(/[^a-zA-Z0-9_-]/g, "_")
|
||||
result[sanitizedClientName + "_" + sanitizedToolName] = tool
|
||||
}
|
||||
}
|
||||
log.info("tools() final result", { toolCount: Object.keys(result).length })
|
||||
return result
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user