get_metrics
Retrieve performance metrics and action history for Android device automation, including per-tool latency and success/failure counts.
Instructions
Get performance metrics and action history for the MCP server. Shows per-tool latency, success/failure counts.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- The 'get_metrics' tool handler is defined within the registerAutomationTools function. It aggregates metrics from the metrics utility, screenshot cache, and UI cache.
'get_metrics', { description: 'Get performance metrics and action history for the MCP server. Shows per-tool latency, success/failure counts.', inputSchema: {}, }, async () => { const toolMetrics = metrics.getToolMetrics(); const recentHistory = metrics.getHistory(20); const screenshotCacheStats = getScreenshotCacheStats(); const uiCacheStats = uiTreeCache.stats(); const isLooping: Record<string, boolean> = {}; // Check loop status for known devices for (const key of Object.keys(toolMetrics)) { // Not per-device, skip } return { content: [{ type: 'text' as const, text: JSON.stringify({ success: true, toolMetrics, caches: { screenshotCache: screenshotCacheStats, uiTreeCache: uiCacheStats, }, recentActions: recentHistory.map(h => ({ tool: h.tool, device: h.deviceId, durationMs: h.durationMs, success: h.success, ago: `${Math.round((Date.now() - h.timestamp) / 1000)}s`, })), }, null, 2), }], }; } );