Rocky_Mountain_Vending/.pnpm-store/v10/files/fe/02dcac2ebd0e80ea51086e52694718cc442f2b37a01e27cfecb62aa8b41927e05900e362e8525c0914ddf7b2af6bbd815fb41f629fb874abc0f1903581ccf5
DMleadgen 46d973904b
Initial commit: Rocky Mountain Vending website
Next.js website for Rocky Mountain Vending company featuring:
- Product catalog with Stripe integration
- Service areas and parts pages
- Admin dashboard with Clerk authentication
- SEO optimized pages with JSON-LD structured data

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-12 16:22:15 -07:00

59 lines
No EOL
1.6 KiB
Text

/**
* Telemetry tracker for MCP tool call usage.
* Tracks invocation counts for each MCP tool to be reported via telemetry.
*/ class McpTelemetryTracker {
/**
* Record a tool call invocation
*/ recordToolCall(toolName) {
const current = this.usageMap.get(toolName) || 0;
this.usageMap.set(toolName, current + 1);
}
/**
* Get all tool usages as an array
*/ getUsages() {
return Array.from(this.usageMap.entries()).map(([featureName, count])=>({
featureName,
invocationCount: count
}));
}
/**
* Reset all usage tracking
*/ reset() {
this.usageMap.clear();
}
/**
* Check if any tools have been called
*/ hasUsage() {
return this.usageMap.size > 0;
}
constructor(){
this.usageMap = new Map();
}
}
// Singleton instance
export const mcpTelemetryTracker = new McpTelemetryTracker();
/**
* Get MCP tool usage telemetry
*/ export function getMcpTelemetryUsage() {
return mcpTelemetryTracker.getUsages();
}
/**
* Reset MCP telemetry tracker
*/ export function resetMcpTelemetry() {
mcpTelemetryTracker.reset();
}
/**
* Record MCP telemetry usage to the telemetry instance
*/ export function recordMcpTelemetry(telemetry) {
const mcpUsages = getMcpTelemetryUsage();
if (mcpUsages.length === 0) {
return;
}
const { eventMcpToolUsage } = require('../../telemetry/events/build');
const events = eventMcpToolUsage(mcpUsages);
for (const event of events){
telemetry.record(event);
}
}
//# sourceMappingURL=mcp-telemetry-tracker.js.map