Skip to main content
Glama

get_index_stats

Read-only

Retrieve per-index size, fragmentation, and scan traffic to identify which index drives disk or memory pressure, using hierarchical bucket, scope, collection, and index filters.

Instructions

Get per-index statistics (size, fragmentation, scan traffic) from the Index Service.

Names which index is responsible for disk or memory pressure — use it after get_cluster_metrics shows a node's index disk climbing.

Filters are hierarchical: scope requires bucket, collection requires both, index requires all three. No filters returns every index in the cluster.

Returns nodes (keyed by node, each with an indexer block and an indexes list of bucket/scope/collection/name + stats), nodes_without_index (nodes that answered but do not hold the requested index — expected, since an index lives only where it was placed) and nodes_failed (nodes that could not be reached, so a partial answer is visible as one). indexer is None for filtered calls.

Numbers are per node. A partitioned index appears under several nodes, each reporting only its own share: sum items_count/data_size/disk_size across nodes, but not num_requests, which every hosting node counts in full.

Reading the stats: disk_size far above data_size (see frag_percent) means space reclaimable by compaction; num_requests with last_known_scan_time (Unix ns, 0 = never) identifies unused indexes; num_docs_pending is indexing lag. Counters reset when the indexer restarts, so a low count alone does not prove an index is unused.

skip_empty=True drops zero-valued fields (~two thirds on an idle cluster) — leave it False when hunting unused indexes, since it also removes num_requests: 0.

Input Schema

NameRequiredDescriptionDefault
index_nameNo
scope_nameNo
skip_emptyNo
bucket_nameNo
collection_nameNo

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv1.1.0

TDQS

A4.8/5.0
Behavior5/5

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

Annotations only declare readOnlyHint=true, and the description adds substantial behavior the agent could not otherwise know: partial results surface as nodes_failed, nodes_without_index is expected rather than an error, indexer is None on filtered calls, counters reset on indexer restart, and per-node numbers cannot be summed for num_requests on partitioned indexes.

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?

Purpose and the sibling hook are front-loaded in the first two sentences, and the remaining paragraphs on return shape and stat interpretation are dense rather than padded. It is long overall — the 'Reading the stats' paragraph drifts into analytical advice — but nearly every sentence carries information an agent would otherwise get wrong.

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?

For a five-parameter, filter-hierarchy diagnostic tool this covers everything needed to call and interpret it: filter preconditions, node-level semantics, failure visibility, and the skip_empty trade-off. An output schema exists, so the extra return-value detail is bonus rather than padding.

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

Parameters4/5

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

Schema description coverage is 0%, so the description must carry the load — and it does explain the non-obvious constraint that filters are hierarchical (scope requires bucket, index requires all three) and documents skip_empty's effect and caveat in detail. The individual name parameters are only covered via that hierarchy rule rather than individually, leaving a small gap.

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?

States a specific verb and resource — per-index statistics (size, fragmentation, scan traffic) from the Index Service — and immediately frames the diagnostic question it answers (which index is responsible for disk/memory pressure). It also positions itself relative to the sibling get_cluster_metrics, so an agent can distinguish it from list_indexes/get_index_advisor_recommendations without opening a schema.

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?

Gives an explicit trigger condition: call it after get_cluster_metrics shows a node's index disk climbing. It also supplies a usage branch on skip_empty ('leave it False when hunting unused indexes'), which is real when-to-use guidance rather than a restatement of the parameter.

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