Skip to main content
Glama
metrics.ts869 B
export interface MetricSnapshot { requests: Record<string, number>; errors: Record<string, number>; durations: Record<string, number[]>; } export class Metrics { private requests: Record<string, number> = {}; private errors: Record<string, number> = {}; private durations: Record<string, number[]> = {}; recordRequest(tool: string) { this.requests[tool] = (this.requests[tool] ?? 0) + 1; } recordError(tool: string) { this.errors[tool] = (this.errors[tool] ?? 0) + 1; } recordDuration(tool: string, durationMs: number) { if (!this.durations[tool]) this.durations[tool] = []; this.durations[tool].push(durationMs); } snapshot(): MetricSnapshot { return { requests: { ...this.requests }, errors: { ...this.errors }, durations: { ...this.durations }, }; } } export const metrics = new Metrics();

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/seovimalraj/locations'

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