Skip to main content
Glama

consumer_lag

Measure Kafka consumer group lag for 1 to 1000 topics in one call. Returns production and consumption rates, backlog state, and an ETA only when lag is shrinking.

Instructions

Measure consumer lag for 1 to 1000 topics in one call through items: production and consumption rates, and whether each topic's backlog is caught up, draining, growing, stalled or has no active consumers. Returns an ETA only when lag is shrinking.

Results follow items order, each carrying index with result or error. Measuring one topic is an items array of length one.

Consumption rate is sampled for sample_seconds, so the call waits that long. Up to 4 windows run at a time, so the call takes about sample_seconds per 4 items. Set skip_consume_rate for an immediate result without an ETA.

Input Schema

NameRequiredDescriptionDefault
itemsYesThe measurements to take, 1 to 1000 of them. Measuring one topic is an array of length one. Up to 4 sampling windows run at a time, so the call takes about sample_seconds for every 4 measurements.

Output Schema

NameRequiredDescriptionDefault
atomicYes
failedYes
appliedYes
resultsYes
succeededYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed14 schema fields changedv0.2.7
    • changedInput schema / properties / items / description
      Previous value: -"The measurements to take, 1 to 100 of them. Measuring one topic is an array of length one. Sampling windows run concurrently, so several measurements do not add their wait times together."New value: +"The measurements to take, 1 to 1000 of them. Measuring one topic is an array of length one. Up to 4 sampling windows run at a time, so the call takes about sample_seconds for every 4 measurements."
    • addedInput schema / properties / items / items / properties / measure_backlog_age
      Added value: +{
      +  "description": "Optional. When true, read the next unconsumed message of every lagging partition to report how old the backlog is (committed_timestamp, lag_seconds, oldest_unconsumed_at) and whether it is at risk of being deleted by retention before it is consumed (retention_risk). Costs one fetch per lagging partition.",
      +  "type": "boolean"
      +}
    • changedInput schema / properties / items / items / properties / sample_seconds / description
      Previous value: -"Optional number of seconds to sample the consume rate over. Defaults to 5. The call blocks for this long, because Kafka stores no history of past commits and the rate can only be measured by comparing two readings."New value: +"Optional number of seconds to sample the consume rate over. Defaults to 5, at most 300. The call blocks for this long, because Kafka stores no history of past commits and the rate can only be measured by comparing two readings."
    • addedOutput schema / properties / results / items / properties / result / properties / groups / items / properties / oldest_unconsumed_at
      Added value: +{
      +  "type": [
      +    "null",
      +    "string"
      +  ]
      +}
    • addedOutput schema / properties / results / items / properties / result / properties / groups / items / properties / partitions / items / properties / committed_timestamp
      Added value: +{
      +  "type": [
      +    "null",
      +    "string"
      +  ]
      +}
    • addedOutput schema / properties / results / items / properties / result / properties / groups / items / properties / partitions / items / properties / lag_seconds
      Added value: +{
      +  "type": [
      +    "null",
      +    "number"
      +  ]
      +}
    • addedOutput schema / properties / results / items / properties / result / properties / groups / items / properties / partitions / items / properties / offset_expired
      Added value: +{
      +  "type": "boolean"
      +}
    • addedOutput schema / properties / results / items / properties / result / properties / groups / items / properties / partitions / items / properties / start_offset
      Added value: +{
      +  "type": "integer"
      +}
    • changedOutput schema / properties / results / items / properties / result / properties / groups / items / properties / partitions / items / required
      Previous value: -[
      -  "partition",
      -  "committed_offset",
      -  "end_offset",
      -  "lag"
      -]New value: +[
      +  "partition",
      +  "committed_offset",
      +  "start_offset",
      +  "end_offset",
      +  "lag"
      +]
    • addedOutput schema / properties / results / items / properties / result / properties / groups / items / properties / retention_risk
      Added value: +{
      +  "type": "boolean"
      +}
    • addedOutput schema / properties / results / items / properties / result / properties / groups / items / properties / warnings
      Added value: +{
      +  "items": {
      +    "type": "string"
      +  },
      +  "type": [
      +    "null",
      +    "array"
      +  ]
      +}
    • addedOutput schema / properties / results / items / properties / result / properties / produce_rate / properties / partitions
      Added value: +{
      +  "items": {
      +    "additionalProperties": false,
      +    "properties": {
      +      "last_hour": {
      +        "type": "integer"
      +      },
      +      "last_minute": {
      +        "type": "integer"
      +      },
      +      "partition": {
      +        "maximum": 2147483647,
      +        "minimum": -2147483648,
      +        "type": "integer"
      +      }
      +    },
      +    "required": [
      +      "partition",
      +      "last_minute",
      +      "last_hour"
      +    ],
      +    "type": "object"
      +  },
      +  "type": [
      +    "null",
      +    "array"
      +  ]
      +}
    • changedOutput schema / properties / results / items / properties / result / properties / produce_rate / required
      Previous value: -[
      -  "last_second",
      -  "last_minute",
      -  "last_hour",
      -  "note"
      -]New value: +[
      +  "last_second",
      +  "last_minute",
      +  "last_hour",
      +  "partitions",
      +  "note"
      +]
    • addedOutput schema / properties / results / items / properties / result / properties / retention_ms
      Added value: +{
      +  "type": [
      +    "null",
      +    "integer"
      +  ]
      +}
  2. First observedv0.2.0

TDQS

A4.3/5.0
Behavior5/5

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

With no annotations, the description carries the full burden and does so: it discloses that the call blocks, why (Kafka stores no commit history), the concurrency ceiling (4 windows), the resulting latency model ('about sample_seconds per 4 items'), per-item error reporting via index, and the conditional ETA. This is exactly the behavioral context an agent needs before committing to a blocking call.

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 is front-loaded in the first sentence, then output shape, then cost model, then the opt-out flag — a sensible order. Slight redundancy: the '4 windows at a time / sample_seconds per 4 items' fact is stated twice and is also repeated in the schema's items description.

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 single batched parameter with an output schema present, everything an agent needs is covered: batch limits, ordering contract, failure isolation per item, latency, and the flag to skip sampling. Return-value internals are correctly left to the output schema.

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 coverage is 100%, so baseline is 3; the description adds value beyond the schema by tying items ordering to results, clarifying the length-one case, and reinforcing the wall-clock cost of sample_seconds. It stops short of describing the group-resolution default in prose, leaving that to the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb+resource ('Measure consumer lag') with explicit scope (1 to 1000 topics in one call) and enumerates the outputs produced (production/consumption rates, backlog state, ETA). However, it never names an overlapping sibling such as describe_consumer_group or list_consumer_groups, so sibling disambiguation is left to inference.

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?

Clear operational guidance: 'Set skip_consume_rate for an immediate result without an ETA' and 'Measuring one topic is an items array of length one' tell the agent how to size and configure calls. It lacks explicit when-not-to-use or alternative-tool routing, so it falls short of a 5.

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