get_slowlog
Retrieve recent slow commands from Valkey/Redis slowlog to identify performance bottlenecks and optimize database queries.
Instructions
Get the most recent slow commands from the slowlog.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| count | No | Number of entries to return (default 25) | |
| instanceId | No | Optional instance ID override |
Implementation Reference
- The handler logic for the 'get_slowlog' tool is defined in proprietary/ai/tools/monitoring-tools.ts as a LangChain tool. It calls the metricsService.getSlowLog method and formats the results for the LLM.
const getSlowlog = tool( async ({ count, connectionId }: { count: number; connectionId?: string }) => { // Parameters: count, excludeClientName, startTime, endTime, connectionId const entries = await metricsService.getSlowLog(count, undefined, undefined, undefined, connectionId); return JSON.stringify( entries.slice(0, count).map((e) => ({ command: e.command.slice(0, 5).join(' '), duration_ms: (e.duration / 1000).toFixed(2), timestamp: new Date(e.timestamp * 1000).toISOString(), client: e.clientAddress, })) ); },