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`;
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions 'Get breakdown' but doesn't specify what the breakdown includes (e.g., metrics, timeframes), whether it's read-only or has side effects, or any constraints like rate limits or authentication needs. This leaves significant gaps in understanding the tool's behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that directly states the tool's purpose without unnecessary words. It's front-loaded and clear, though it could be slightly more structured by specifying scope (e.g., 'for the current session' or 'across all tools').

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of usage analytics and lack of annotations or output schema, the description is incomplete. It doesn't explain what the breakdown entails (e.g., data format, included metrics), making it hard for an agent to use effectively without additional context or trial-and-error.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 0 parameters with 100% coverage, so no parameter documentation is needed. The description doesn't add parameter details, which is appropriate here, but it could slightly enhance value by hinting at implicit parameters (e.g., default timeframes), though not required. Baseline is high due to no parameters.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose with a specific verb ('Get') and resource ('breakdown of tool usage and edit decisions'), making it easy to understand what it does. However, it doesn't explicitly differentiate from sibling tools like 'get_usage_summary' or 'get_session_analytics', which might provide similar breakdowns, so it falls short of a perfect score.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. With multiple sibling tools related to usage (e.g., 'get_usage_summary', 'get_usage_trends'), it lacks explicit context or exclusions, leaving the agent to infer usage based on the name alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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