Skip to main content
Glama

list_topics

Lists Kafka topics with partition count, replication factor, and topic-level configs. Use a JavaScript predicate to filter topics by name, partitions, replication factor, internal status, or configs.

Instructions

List the topics on the endpoint's cluster, sorted by name, each with its partition count, replication factor and the configs it sets for itself.

Filter with an optional JavaScript predicate. A name match is return topic.indexOf('orders') >= 0, and the predicate can also read partitions, replication_factor, internal and configs — questions a substring filter cannot express, such as which topics have more than six partitions, only one replica, or a compacted cleanup policy.

Only configs a topic sets for itself are reported, because inherited cluster defaults would make every topic look configured. Topics whose predicate throws are counted in script_errors rather than listed, so a broken filter is never mistaken for an empty cluster.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
scriptNoOptional JavaScript that decides whether a topic is listed. Return true to keep it. In scope: topic (the name), partitions (number), replication_factor (number), internal (true for Kafka's own topics such as __consumer_offsets) and configs (an object of the values this topic sets for itself, such as configs['retention.ms']; inherited cluster defaults are not included). Examples: return topic.indexOf('orders') >= 0; return partitions > 6; return configs['cleanup.policy'] === 'compact'; return replication_factor === 1 && !internal. Omit to list every topic.
timeout_secondsNoOptional wall-clock limit in seconds for evaluating the script. Defaults to 30. A topic whose evaluation is cut short is counted in script_errors rather than listed.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
countYes
topicsYes
script_errorsNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.2.0

TDQS

A3.8/5.0
Behavior4/5

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

With no annotations, the description carries the full burden and mostly succeeds: it discloses sort order, that only self-set configs are reported (inherited defaults excluded), and that throwing or timed-out predicates land in script_errors rather than silently shrinking results. It stops short of stating key behavioral facts such as read-only safety, pagination, or rate limits.

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?

Front-loaded with the core action and return shape, then filter mechanics, then edge-case behavior. Mostly every sentence earns its place, though the 'only configs a topic sets for itself' point and the predicate examples echo what the input schema already states.

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?

An output schema exists, so return values need not be re-explained, and the description covers everything else an agent needs: scope, ordering, filter semantics, error accounting, and the config-inheritance caveat. Nothing material is missing for a read-only list tool.

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?

Schema description coverage is 100%, so the baseline is 3; the schema already documents in-scope variables, examples, and the timeout default. The description reinforces the semantics (self-set configs only, predicate failures counted as errors) but adds little the schema does not already say.

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 and resource with scope ('List the topics on the endpoint's cluster') and enumerates the returned fields (partition count, replication factor, self-set configs), so an agent knows exactly what it gets. It does not, however, name or contrast itself against the closest sibling, describe_topic, leaving that distinction 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 Guidelines3/5

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

The description is explicit about when the script predicate is warranted versus a simple substring match ('questions a substring filter cannot express'), which is useful. But it never says when to call list_topics rather than describe_topic, cluster_health, or list_clusters, and offers no when-not guidance at the tool level.

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