Skip to main content
Glama
cordlesssteve

Claude Telemetry MCP

check_usage_limits

Monitor Claude usage against token and cost limits for daily, weekly, and session periods to prevent overages and manage resources.

Instructions

Check current usage against specified limits and get warnings

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
daily_token_limitNoDaily token limit to check against
weekly_token_limitNoWeekly token limit to check against
session_token_limitNoSession token limit to check against
daily_cost_limitNoDaily cost limit in USD to check against
weekly_cost_limitNoWeekly cost limit in USD to check against
session_cost_limitNoSession cost limit in USD to check against

Implementation Reference

  • Core handler function that implements the check_usage_limits tool logic by comparing current usage metrics against provided limits and generating appropriate warnings.
    async checkUsageLimits(limits: UsageLimits): Promise<UsageWarnings> {
      const summary = await this.getUsageSummary();
      const warnings: string[] = [];
      const percentages: any = {};
    
      // Check daily limits
      if (limits.dailyTokenLimit) {
        const dailyPercent = (summary.today.tokens / limits.dailyTokenLimit) * 100;
        percentages.dailyTokens = dailyPercent;
        if (dailyPercent > 90) {
          warnings.push(`Daily token usage at ${dailyPercent.toFixed(1)}% of limit`);
        } else if (dailyPercent > 80) {
          warnings.push(`Daily token usage approaching limit (${dailyPercent.toFixed(1)}%)`);
        }
      }
    
      // Check weekly limits
      if (limits.weeklyTokenLimit) {
        const weeklyPercent = (summary.thisWeek.tokens / limits.weeklyTokenLimit) * 100;
        percentages.weeklyTokens = weeklyPercent;
        if (weeklyPercent > 90) {
          warnings.push(`Weekly token usage at ${weeklyPercent.toFixed(1)}% of limit`);
        } else if (weeklyPercent > 80) {
          warnings.push(`Weekly token usage approaching limit (${weeklyPercent.toFixed(1)}%)`);
        }
      }
    
      // Check session limits
      if (limits.sessionTokenLimit) {
        const sessionPercent = (summary.currentSession.tokens / limits.sessionTokenLimit) * 100;
        percentages.sessionTokens = sessionPercent;
        if (sessionPercent > 90) {
          warnings.push(`Session token usage at ${sessionPercent.toFixed(1)}% of limit`);
        } else if (sessionPercent > 80) {
          warnings.push(`Session token usage approaching limit (${sessionPercent.toFixed(1)}%)`);
        }
      }
    
      // Similar checks for cost limits...
      if (limits.dailyCostLimit) {
        const dailyCostPercent = (summary.today.cost / limits.dailyCostLimit) * 100;
        percentages.dailyCost = dailyCostPercent;
        if (dailyCostPercent > 80) {
          warnings.push(`Daily cost approaching limit (${dailyCostPercent.toFixed(1)}%)`);
        }
      }
    
      return {
        warnings,
        usage: {
          current: summary.today,
          limits,
          percentages
        }
      };
    }
  • src/index.ts:72-104 (registration)
    Tool registration in the ListTools response, including name, description, and input schema definition.
    {
      name: 'check_usage_limits',
      description: 'Check current usage against specified limits and get warnings',
      inputSchema: {
        type: 'object',
        properties: {
          daily_token_limit: {
            type: 'number',
            description: 'Daily token limit to check against',
          },
          weekly_token_limit: {
            type: 'number',
            description: 'Weekly token limit to check against',
          },
          session_token_limit: {
            type: 'number',
            description: 'Session token limit to check against',
          },
          daily_cost_limit: {
            type: 'number',
            description: 'Daily cost limit in USD to check against',
          },
          weekly_cost_limit: {
            type: 'number',
            description: 'Weekly cost limit in USD to check against',
          },
          session_cost_limit: {
            type: 'number',
            description: 'Session cost limit in USD to check against',
          },
        },
      },
    },
  • TypeScript interface defining the input parameters (UsageLimits) for the checkUsageLimits function.
    export interface UsageLimits {
      dailyTokenLimit?: number;
      weeklyTokenLimit?: number;
      sessionTokenLimit?: number;
      dailyCostLimit?: number;
      weeklyCostLimit?: number;
      sessionCostLimit?: number;
    }
  • TypeScript interface defining the output structure (UsageWarnings) returned by the handler.
    export interface UsageWarnings {
      warnings: string[];
      usage: {
        current: UsageData;
        limits: UsageLimits;
        percentages: {
          dailyTokens?: number;
          weeklyTokens?: number;
          sessionTokens?: number;
          dailyCost?: number;
          weeklyCost?: number;
          sessionCost?: number;
        };
      };
    }
  • MCP dispatch handler case that parses tool arguments, calls the telemetry service handler, and formats the response.
    case 'check_usage_limits': {
      const limits: UsageLimits = {
        dailyTokenLimit: typeof args?.daily_token_limit === 'number' ? args.daily_token_limit : undefined,
        weeklyTokenLimit: typeof args?.weekly_token_limit === 'number' ? args.weekly_token_limit : undefined,
        sessionTokenLimit: typeof args?.session_token_limit === 'number' ? args.session_token_limit : undefined,
        dailyCostLimit: typeof args?.daily_cost_limit === 'number' ? args.daily_cost_limit : undefined,
        weeklyCostLimit: typeof args?.weekly_cost_limit === 'number' ? args.weekly_cost_limit : undefined,
        sessionCostLimit: typeof args?.session_cost_limit === 'number' ? args.session_cost_limit : undefined,
      };
    
      const warnings = await this.telemetryService.checkUsageLimits(limits);
      return {
        content: [
          {
            type: 'text',
            text: this.formatUsageWarnings(warnings),
          },
        ],
      };
    }
Behavior2/5

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

No annotations are provided, so the description carries full burden for behavioral disclosure. While 'check' implies a read operation, the description doesn't specify whether this requires authentication, has rate limits, returns real-time or cached data, or what format the warnings take. For a tool with 6 parameters and no annotation coverage, this is inadequate behavioral transparency.

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 extremely concise at just 9 words, front-loading the core purpose without any wasted language. Every word earns its place - 'check' (verb), 'current usage' (resource), 'against specified limits' (action), 'and get warnings' (outcome). This is a model of efficiency.

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

Completeness3/5

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

Given 6 parameters with full schema coverage but no annotations and no output schema, the description is minimally adequate. It states what the tool does but lacks context about when to use it versus siblings, what the warnings contain, or behavioral constraints. For a tool with this complexity and no output schema, more completeness would be expected regarding the return value.

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

Parameters3/5

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

Schema description coverage is 100%, with all 6 parameters clearly documented in the schema. The description mentions 'specified limits' which aligns with the parameters, but adds no additional semantic context beyond what's already in the schema descriptions. With complete schema coverage, the baseline score of 3 is appropriate.

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 as checking current usage against specified limits and getting warnings, which is a specific verb+resource combination. However, it doesn't explicitly differentiate from sibling tools like 'get_usage_warnings' or 'get_current_session_usage', which appear related. The purpose is clear but lacks sibling differentiation.

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 dealing with usage data (compare_usage_periods, get_usage_warnings, get_current_session_usage, etc.), there's no indication of when this specific limit-checking tool is appropriate versus other usage-related tools. No exclusions or prerequisites are mentioned.

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