Skip to main content
Glama
cordlesssteve

Claude Telemetry MCP

get_tool_usage_breakdown

Analyze tool usage patterns and edit decisions to monitor Claude Code session activity and identify optimization opportunities.

Instructions

Get breakdown of tool usage and edit decisions

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • MCP tool request handler that executes the get_tool_usage_breakdown tool by calling the telemetry service and formatting the response.
    case 'get_tool_usage_breakdown': { const breakdown = await this.telemetryService.getToolUsageBreakdown(); return { content: [ { type: 'text', text: this.formatToolUsageBreakdown(breakdown), }, ], }; }
  • TypeScript interface defining the structure of the tool's output data.
    export interface ToolUsageBreakdown { totalEditDecisions: number; averageDecisionsPerSession: number; peakDecisionHour: number; }
  • src/index.ts:155-162 (registration)
    Tool registration in the MCP tools array, including name, description, and empty input schema.
    { name: 'get_tool_usage_breakdown', description: 'Get breakdown of tool usage and edit decisions', inputSchema: { type: 'object', properties: {}, }, },
  • Main logic for fetching and computing tool usage breakdown from Prometheus metrics.
    async getToolUsageBreakdown(): Promise<ToolUsageBreakdown> { const queries = { totalEditDecisions: 'sum(claude_code_code_edit_tool_decision_total)', totalSessions: 'sum(claude_code_session_count_total)' }; const results = await this.executeQueries(queries); const totalSessions = results.totalSessions || 1; return { totalEditDecisions: results.totalEditDecisions || 0, averageDecisionsPerSession: (results.totalEditDecisions || 0) / totalSessions, peakDecisionHour: 14 // Placeholder - would need hourly breakdown analysis }; }
  • Helper function to format the tool usage breakdown data into a markdown response.
    private formatToolUsageBreakdown(breakdown: ToolUsageBreakdown): string { return `## Tool Usage Breakdown\n\n` + `**Total Edit Decisions**: ${breakdown.totalEditDecisions.toLocaleString()}\n` + `**Average Decisions/Session**: ${Math.round(breakdown.averageDecisionsPerSession)}\n` + `**Peak Decision Hour**: ${breakdown.peakDecisionHour}:00`; }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/cordlesssteve/claude-telemetry-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server