Skip to main content
Glama

Aggregate alerts by field

wazuh_alert_stats
Read-onlyIdempotent

Aggregate Wazuh alerts by specified fields (e.g., rule, agent) to return counts, with filters for time range, severity, agent, and group.

Instructions

Group alerts by one or two fields and return counts — the tool for 'top 10 rules today', 'which agents are noisiest', 'alert counts by MITRE tactic', or 'top source IPs per agent'. Far cheaper than fetching alerts and counting them yourself.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
endNoWindow end. Defaults to now.
topNoNumber of buckets for the first field.
textNoLucene query to narrow the set.
startNoWindow start. Defaults to 24h ago.
then_byNoOptional second grouping field, nested inside the first.
agent_idNo
group_byNoField to group by. Common choices: rule.description, rule.id, rule.level, rule.groups, agent.name, rule.mitre.technique, rule.mitre.tactic, data.srcip, location, decoder.name.rule.description
severityNo
min_levelNo
rule_groupNo
top_nestedNoBuckets for the second field.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.2/5.0
Behavior4/5

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

The readOnlyHint and idempotentHint annotations already communicate that this is a safe, read-only operation, and the description does not contradict that. The description also clarifies it returns aggregated counts rather than raw alert data, adding useful behavioral context.

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 long and packs the core purpose, example use cases, and a performance benefit without unnecessary detail. It is well-structured and easy to scan.

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?

The description gives enough context for an agent to decide when to use this aggregation tool and understand that it returns counts. It does not spell out the exact output shape, but the output schema is marked as available and the use cases make the expected result clear.

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?

Several key parameters have useful descriptions, especially group_by with common field choices, start/end defaults, and top_nested. However, agent_id, severity, min_level, and rule_group lack descriptions, and the tool description itself only partially compensates. Schema coverage is 64%, so parameter semantics are adequate but not comprehensive.

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 the tool aggregates alerts by one or two fields and returns counts, with concrete example use cases such as 'top 10 rules today' and 'top source IPs per agent'. This makes the purpose distinct and immediately understandable.

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 provides good usage guidance by listing common aggregation scenarios and explicitly notes that this is far cheaper than fetching alerts and counting them yourself. It does not directly name sibling tools like wazuh_search_alerts, but the use cases make the appropriate context clear.

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