Skip to main content
Glama
wn01011

llm-token-tracker

clear_usage

Clear token usage data for a specific user in the LLM token tracker MCP server to reset tracking metrics.

Instructions

Clear usage data

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
user_idYesUser ID to clear

Implementation Reference

  • Handler function that executes the clear_usage tool: destructures user_id from arguments, calls tracker.clearUserUsage(user_id), and returns a confirmation message.
    private clearUsage(args: any) { const { user_id } = args; this.tracker.clearUserUsage(user_id); return { content: [ { type: 'text', text: `✅ Cleared usage data for ${user_id}` } ] }; }
  • Tool registration in the ListTools handler, defining name, description, and input schema for clear_usage.
    { name: 'clear_usage', description: 'Clear usage data', inputSchema: { type: 'object', properties: { user_id: { type: 'string', description: 'User ID to clear' } }, required: ['user_id'] } },
  • Input schema definition for the clear_usage tool, requiring a user_id string.
    inputSchema: { type: 'object', properties: { user_id: { type: 'string', description: 'User ID to clear' } }, required: ['user_id'] }
  • Supporting helper method in TokenTracker class that deletes the user's usage history and totals from memory and persists the change to file storage.
    clearUserUsage(userId: string): void { this.usageHistory.delete(userId); this.userTotals.delete(userId); // Save to file storage after clearing if (this.storage) { this.saveToStorage(); } }

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/wn01011/llm-token-tracker'

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