Skip to content

feat(secops): add get_stats aggregation tool with unit tests#246

Open
jllangley wants to merge 2 commits intogoogle:mainfrom
jllangley:feat/add-stats-aggregation-tool
Open

feat(secops): add get_stats aggregation tool with unit tests#246
jllangley wants to merge 2 commits intogoogle:mainfrom
jllangley:feat/add-stats-aggregation-tool

Conversation

@jllangley
Copy link
Copy Markdown

Adds a new get_stats MCP tool that executes Chronicle UDM stats/aggregation queries (stats pipeline), returning structured columns and rows. Supports the same flexible time-range parameters (start_time, end_time, hours_back) as the existing search tools via the shared parse_time_range utility.

Also adds:

  • Unit tests covering time parsing, parameter forwarding, error handling, and API failure recovery for get_stats
  • Integration tests verifying the response contract and numeric type casting of count() values against a live Chronicle instance

Adds a new `get_stats` MCP tool that executes Chronicle UDM stats/aggregation
queries (| stats pipeline), returning structured columns and rows. Supports the
same flexible time-range parameters (start_time, end_time, hours_back) as the
existing search tools via the shared parse_time_range utility.

Also adds:
- Unit tests covering time parsing, parameter forwarding, error handling, and
  API failure recovery for get_stats
- Integration tests verifying the response contract and numeric type casting
  of count() values against a live Chronicle instance
@jllangley jllangley requested a review from a team April 1, 2026 21:28
@google-cla
Copy link
Copy Markdown

google-cla bot commented Apr 1, 2026

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@dandye
Copy link
Copy Markdown
Collaborator

dandye commented Apr 1, 2026

Thank you for this contribution, @jllangley!
If you could please sign the CLA mentioned above, we can then work on reviewing.

Rewrites the get_stats tool docstring to reflect the actual Chronicle
YARA-L 2.0 query structure (filtering → match → outcome → order → limit)
and the full set of supported aggregate functions (array, array_distinct,
avg, count, count_distinct, earliest, latest, max, min, stddev, sum).
Replaces the incorrect pipe-style examples with correct YARA-L 2.0 syntax.

Also ignores the local stats_doc.md reference file via .gitignore.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants