Skip to main content
Glama
cordlesssteve

Claude Telemetry MCP

get_week_usage

Retrieve total usage metrics for the current week (Monday-Sunday) to monitor Claude Code session analytics and track token usage patterns.

Instructions

Get total usage metrics for the current week (Monday-Sunday)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • MCP CallToolRequest handler case for 'get_week_usage': calls telemetryService.getWeekUsage() and returns formatted UsageData as text content.
    case 'get_week_usage': {
      const usage = await this.telemetryService.getWeekUsage();
      return {
        content: [
          {
            type: 'text',
            text: this.formatUsageData('This Week', usage),
          },
        ],
      };
    }
  • Core getWeekUsage implementation: defines Prometheus queries for 7d metric increases and builds UsageData from results.
    async getWeekUsage(): Promise<UsageData> {
      const queries = {
        tokens: `sum(increase(claude_code_token_usage_tokens_total[7d]))`,
        cost: `sum(increase(claude_code_cost_usage_USD_total[7d]))`,
        sessions: `sum(increase(claude_code_session_count_total[7d]))`,
        activeTime: `sum(increase(claude_code_active_time_seconds_total[7d]))`,
        linesOfCode: `sum(increase(claude_code_lines_of_code_count_total[7d]))`,
        commits: `sum(increase(claude_code_commit_count_total[7d]))`,
        editDecisions: `sum(increase(claude_code_code_edit_tool_decision_total[7d]))`
      };
    
      const results = await this.executeQueries(queries);
      return this.buildUsageData(results);
    }
  • src/index.ts:54-61 (registration)
    Tool registration in ListTools response: defines name, description, and empty inputSchema for get_week_usage.
    {
      name: 'get_week_usage',
      description: 'Get total usage metrics for the current week (Monday-Sunday)',
      inputSchema: {
        type: 'object',
        properties: {},
      },
    },
  • UsageData interface defining the structure of usage metrics returned by getWeekUsage.
    export interface UsageData {
      tokens: number;
      cost: number;
      sessions: number;
      activeTime: number;
      linesOfCode: number;
      commits: number;
      editDecisions: number;
    }
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It states what the tool does but doesn't describe how it behaves—e.g., whether it's read-only, requires authentication, has rate limits, or what the return format looks like. This is a significant gap for a tool with zero annotation coverage.

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

Conciseness5/5

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

The description is a single, efficient sentence that front-loads the core purpose ('Get total usage metrics') and adds necessary context ('for the current week (Monday-Sunday)'). There is zero waste, and every word earns its place.

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 lack of annotations and output schema, the description is incomplete. It doesn't explain what 'total usage metrics' includes, the return format, or behavioral traits like error handling. For a tool with no structured data beyond the input schema, more context is needed to be fully helpful to an agent.

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 tool has 0 parameters, and schema description coverage is 100%, so there's no need for parameter documentation in the description. The description appropriately doesn't mention parameters, earning a high baseline score for not adding unnecessary information.

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 ('total usage metrics'), and specifies the time scope ('current week (Monday-Sunday)'). However, it doesn't explicitly differentiate from sibling tools like 'get_today_usage' or 'get_usage_summary', which prevents 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 like 'get_today_usage' or 'get_usage_summary'. It implies usage for current week metrics but doesn't specify exclusions or prerequisites, leaving the agent to infer context from tool names 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