Skip to main content
Glama

Count matching documents

count
Read-only

Count documents matching an OpenSearch DSL query clause without returning the documents. Use it when you need just the match count, not the data.

Instructions

Count documents matching a DSL query clause, without returning the documents.

    Use this instead of search_dsl when you only need the number of matches, not
    the documents themselves. Note the query_dsl shape differs from search_dsl's —
    the schema says how. Returns the raw OpenSearch _count response
    ({"count": N, ...}).

    This tool takes no time arguments and applies no default window, so a
    bare call counts everything the index still holds, which on any real
    capture is millions of documents. Bound it with a range clause inside
    query_dsl, use malcolm_search when you want a human-readable time range,
    or arkime_sessions_summary when you want byte and packet totals beside
    the count.
    

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
indexNoIndex or pattern to count over. Accepts a wildcard; default is the Malcolm sessions index.arkime_sessions3-*
query_dslNoJSON string of the INNER DSL query clause only, e.g. {"term": {"event.dataset": "conn"}} (no "query" wrapper, no "aggs"/"size"). Empty counts all documents (match_all).

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior5/5

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

Despite annotations already indicating safe read-only behavior, the description adds substantial critical context: it takes no time arguments, applies no default window, and a bare call counts all documents held by the index—potentially millions. It also warns about the different query_dsl shape compared to search_dsl, which is not conveyed by annotations.

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

Conciseness4/5

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

The description is well-structured and front-loaded with purpose, but it is slightly verbose in places; for example, 'without returning the documents' and 'not the documents themselves' are redundant. Still, all information is relevant and organized clearly.

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

Completeness5/5

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

Given the tool's moderate complexity, the description fully covers usage, gotchas, alternatives, and safety considerations. An output schema exists, so return format details are not required. It is complete for an agent to select and invoke the tool correctly.

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?

Input schema covers both parameters with full descriptions (index default, query_dsl format and example), so baseline is 3. The description adds minimal parameter-specific guidance beyond pointing to the schema, so no higher score is warranted.

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 begins with a specific verb and resource: 'Count documents matching a DSL query clause, without returning the documents.' This clearly distinguishes it from sibling search_dsl by emphasizing count-only behavior, making the purpose unambiguous.

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

Usage Guidelines5/5

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

Explicitly states when to use this tool: 'Use this instead of search_dsl when you only need the number of matches, not the documents themselves.' It also names alternatives (malcolm_search, arkime_sessions_summary) and clarifies when they are preferable, such as when a human-readable time range or byte/packet totals are needed.

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/nagameTW/mcp-server-malcolm'

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