* Implementation for logMCPError - writes MCP error to debug log and file.
(serverName: string, error: unknown)
| 179 | * Implementation for logMCPError - writes MCP error to debug log and file. |
| 180 | */ |
| 181 | function logMCPErrorImpl(serverName: string, error: unknown): void { |
| 182 | // Not themed, to avoid having to pipe theme all the way down |
| 183 | logForDebugging(`MCP server "${serverName}" ${error}`, { level: 'error' }) |
| 184 | |
| 185 | const logFile = getMCPLogsPath(serverName) |
| 186 | const errorStr = |
| 187 | error instanceof Error ? error.stack || error.message : String(error) |
| 188 | |
| 189 | const errorInfo = { |
| 190 | error: errorStr, |
| 191 | timestamp: new Date().toISOString(), |
| 192 | sessionId: getSessionId(), |
| 193 | cwd: getFsImplementation().cwd(), |
| 194 | } |
| 195 | |
| 196 | getLogWriter(logFile).write(errorInfo) |
| 197 | } |
| 198 | |
| 199 | /** |
| 200 | * Implementation for logMCPDebug - writes MCP debug message to log file. |
nothing calls this directly
no test coverage detected