(mcpClients: MCPServerConnection[])
| 16 | ) |
| 17 | |
| 18 | export function useIdeLogging(mcpClients: MCPServerConnection[]): void { |
| 19 | useEffect(() => { |
| 20 | // Skip if there are no clients |
| 21 | if (!mcpClients.length) { |
| 22 | return |
| 23 | } |
| 24 | |
| 25 | // Find the IDE client from the MCP clients list |
| 26 | const ideClient = getConnectedIdeClient(mcpClients) |
| 27 | if (ideClient) { |
| 28 | // Register the log event handler |
| 29 | ideClient.client.setNotificationHandler( |
| 30 | LogEventSchema(), |
| 31 | notification => { |
| 32 | const { eventName, eventData } = notification.params |
| 33 | logEvent( |
| 34 | `tengu_ide_${eventName}`, |
| 35 | eventData as { [key: string]: boolean | number | undefined }, |
| 36 | ) |
| 37 | }, |
| 38 | ) |
| 39 | } |
| 40 | }, [mcpClients]) |
| 41 | } |
| 42 |
no test coverage detected