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
| Name | Required | Description | Default |
|---|---|---|---|
| user_id | Yes | User ID to clear |
Implementation Reference
- src/mcp-server.ts:343-355 (handler)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}` } ] }; }
- src/mcp-server.ts:127-140 (registration)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'] } },
- src/mcp-server.ts:130-139 (schema)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'] }
- src/tracker.ts:252-260 (helper)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(); } }