Skip to main content
Glama
cordlesssteve

Claude Telemetry MCP

get_usage_summary

Retrieve session, daily, and weekly usage analytics to monitor Claude Code token consumption, costs, and tool patterns.

Instructions

Get comprehensive usage summary for session, today, and this week in one call

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • MCP tool handler for 'get_usage_summary' in CallToolRequestSchema. Delegates to telemetryService.getUsageSummary() and formats response with formatUsageSummary.
    case 'get_usage_summary': { const summary = await this.telemetryService.getUsageSummary(); return { content: [ { type: 'text', text: this.formatUsageSummary(summary), }, ], }; }
  • Core logic implementation: aggregates current session, today, and weekly usage data into a UsageSummary object.
    async getUsageSummary(): Promise<UsageSummary> { const [currentSession, today, thisWeek] = await Promise.all([ this.getCurrentSessionUsage(), this.getTodayUsage(), this.getWeekUsage() ]); return { currentSession, today, thisWeek, period: { start: this.getStartOfWeek().toISOString(), end: new Date().toISOString() } }; }
  • Helper function to format the UsageSummary into a readable markdown text response.
    private formatUsageSummary(summary: UsageSummary): string { let result = '# Usage Summary\n\n'; result += this.formatUsageData('Current Session', summary.currentSession) + '\n\n'; result += this.formatUsageData('Today', summary.today) + '\n\n'; result += this.formatUsageData('This Week', summary.thisWeek) + '\n\n'; result += `**Period**: ${new Date(summary.period.start).toLocaleDateString()} - ${new Date(summary.period.end).toLocaleDateString()}`; return result; }
  • src/index.ts:63-69 (registration)
    Tool registration entry in the ListToolsRequestHandler response, defining name, description, and input schema (no parameters).
    name: 'get_usage_summary', description: 'Get comprehensive usage summary for session, today, and this week in one call', inputSchema: { type: 'object', properties: {}, }, },
  • TypeScript interface defining the structure of the UsageSummary return type used by the tool.
    export interface UsageSummary { currentSession: UsageData; today: UsageData; thisWeek: UsageData; period: { start: string; end: string; }; }

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