Skip to main content
Glama

Order Anomaly Detection

order_anomalies
Read-onlyIdempotent

Identify fraud and revenue spikes by detecting statistical anomalies in recent orders, including high-value, velocity spikes, unusual quantities, off-hours, and new-customer high-value orders.

Instructions

Statistical anomaly detection on recent orders. Flags high-value orders (>3σ from mean), velocity spikes (customer ordering unusually fast), unusual quantities, off-hours purchases (2am-5am), and new-customer high-value orders. Returns an array of anomalies with order_id, anomaly_type, severity (low/medium/high), reason, and recommended_action. Useful for fraud detection and revenue spike investigation.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
store_idYesUUID of a connected store (returned by store_connect with action="connect" or visible in store_connect with action="list" / the store_overview resource)

Implementation Reference

  • Zod schemas and TypeScript types for AnomalyType (five anomaly categories) and AnomalyResult (order_id, anomaly_types, risk_score, risk_level, flags, recommended_action).
    // ── Anomaly Detection ─────────────────────────────────────────────
    export const AnomalyTypeSchema = z.enum([
      'high_value', 'velocity_spike', 'unusual_quantity',
      'off_hours', 'new_customer_high_value',
    ]);
    export type AnomalyType = z.infer<typeof AnomalyTypeSchema>;
    
    export const AnomalyResultSchema = z.object({
      order_id: z.string(),
      order_number: z.string(),
      anomaly_types: z.array(AnomalyTypeSchema),
      risk_score: z.number().min(0).max(100),
      risk_level: z.enum(['low', 'medium', 'high', 'critical']),
      total: z.number(),
      customer_email: z.string().nullable(),
      flags: z.array(z.string()),
      recommended_action: z.string(),
    });
    export type AnomalyResult = z.infer<typeof AnomalyResultSchema>;
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already declare readOnlyHint=true and destructiveHint=false, so safety is clear. The description adds behavioral details about what anomalies are detected and the output structure (fields like order_id, anomaly_type, severity). It does not cover rate limits or time range precision, but overall adds value beyond annotations.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is two sentences, first defining the tool's function and second detailing the output and use cases. Every word is functional, with no redundancy.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

With one well-documented parameter and a detailed output description (even without an output schema), the tool is fairly complete. Missing explicit mention of time range for 'recent orders' is a minor gap.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% coverage with a detailed description for store_id. The tool description does not add additional parameter semantics beyond what the schema provides, so the baseline of 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states 'Statistical anomaly detection on recent orders' and lists specific anomaly types, making the tool's purpose explicit. It distinguishes itself from sibling tools like customers_churn or inventory_forecast which focus on different domains.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description mentions 'Useful for fraud detection and revenue spike investigation,' providing context. However, it does not explicitly state when not to use the tool or compare it to alternatives, missing a bit on usage boundaries.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/enzoemir1/shopops-mcp'

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