Skip to main content
Glama

get_anomalies

Retrieve anomaly detection events from persisted storage to investigate alert triggers or correlate with incidents. BetterDB continuously analyzes memory, hit rate, CPU, and other metrics using Z-score analysis.

Instructions

Get anomaly detection events from persisted storage. BetterDB continuously runs Z-score analysis on memory, hit rate, CPU, and other metrics — this returns the detected anomalies. Use to investigate what triggered an alert or correlate with an incident.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNoMax events to return
metricTypeNoFilter by metric type
startTimeNoStart time (Unix timestamp ms)
instanceIdNoOptional instance ID override

Implementation Reference

  • Tool definition and handler implementation for 'get_anomalies' in the MCP server. It calls the /mcp/instance/{id}/history/anomalies endpoint.
    server.tool(
      'get_anomalies',
      'Get anomaly detection events from persisted storage. BetterDB continuously runs Z-score analysis on memory, hit rate, CPU, and other metrics — this returns the detected anomalies. Use to investigate what triggered an alert or correlate with an incident.',
      {
        limit: z.number().optional().describe('Max events to return'),
        metricType: z.string().optional().describe('Filter by metric type'),
        startTime: z.number().optional().describe('Start time (Unix timestamp ms)'),
        instanceId: z.string().optional().describe('Optional instance ID override'),
      },
      async ({ limit, metricType, startTime, instanceId }) => {
        const id = resolveInstanceId(instanceId);
        const qs = buildQuery({ limit, metricType, startTime });
        const data = await apiFetch(`/mcp/instance/${id}/history/anomalies${qs}`);
        if (isLicenseError(data)) {
          return { content: [{ type: 'text' as const, text: licenseErrorResult(data) }] };
        }
        return {
          content: [{ type: 'text' as const, text: JSON.stringify(data, null, 2) }],
        };
      },

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/BetterDB-inc/monitor'

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