feat: add count_resources aggregation tool#249
Open
yuvalk wants to merge 4 commits into
Open
Conversation
…ueries
Adds the first custom FunctionTool to the agent. When users ask counting
questions ("how many CVEs/hosts/rules?"), this tool calls the MCP tool
with limit=1 and reads the total from response metadata — one API call
instead of paginating through all results.
Supports 13 MCP tools across 6 categories: vulnerability (JSON:API
meta.total_items), inventory (total), advisor/content-sources/image-builder/
RHSM (meta.count). Includes thread-safe session manager singleton, robust
error handling, and JWT auth pass-through.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Updates pagination-handling skill with examples for all resource types: CVEs, hosts, advisor rules, blueprints — so the LLM knows to call count_resources instead of paginating manually. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Covers _extract_total helper, count_resources for all 6 MCP categories (vulnerability, inventory, advisor, content-sources, image-builder, RHSM), error handling (unsupported tools, MCP failures, bad JSON, missing metadata, empty responses, session failures), factory function, and TOOL_TOTAL_PATHS consistency checks. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
luis5tb
reviewed
May 27, 2026
Collaborator
luis5tb
left a comment
There was a problem hiding this comment.
I'm not sure I like the approach here of tightly coupling skills with mcp and tools.
Why not have everything as part of the skill? meaning adding the scripts needed by the skill inside the skills/pagination-handling (or even a new skill if it fits better)
Collaborator
|
what about this instead? #252 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
count_resourcesFunctionTool — the first custom (non-MCP) tool in the agent — that efficiently answers "how many?" questions by calling MCP tools withlimit=1and reading the total count from response metadata, instead of the LLM iterating through all pagesmeta.total_items), inventory (total), advisor/content-sources/image-builder/RHSM (meta.count)Test plan
ruff checkpasses clean🤖 Generated with Claude Code