Skip to main content
Glama
confluentinc

mcp-confluent

Official
by confluentinc

search-topics-by-tag

Filter and list Kafka topics by a specific tag using the Schema Registry REST API, enabling easy topic discovery and management within Confluent Kafka or Confluent Cloud environments.

Instructions

List all topics in the Kafka cluster with the specified tag.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
baseUrlNoThe base URL of the Schema Registry REST API.
limitNoThe maximum number of topics to return.
offsetNoThe offset to start the search from. Used for pagination.
topicTagNoThe tag we wish to search for

Implementation Reference

  • SearchTopicsByTagHandler class implementing the tool's core execution logic via the handle() method, which queries the Confluent Schema Registry Catalog API for topics matching the given tag.
    export class SearchTopicsByTagHandler extends BaseToolHandler {
      async handle(
        clientManager: ClientManager,
        toolArguments: Record<string, unknown>,
      ): Promise<CallToolResult> {
        const { topicTag, limit, offset, baseUrl } =
          searchTopicsByTagArguments.parse(toolArguments);
        if (baseUrl !== undefined && baseUrl !== "") {
          clientManager.setConfluentCloudSchemaRegistryEndpoint(baseUrl);
        }
        const pathBasedClient = wrapAsPathBasedClient(
          clientManager.getConfluentCloudSchemaRegistryRestClient(),
        );
        const { data: response, error } = await pathBasedClient[
          "/catalog/v1/search/basic?types=kafka_topic&tag={topicTag}&limit={limit}&offset={offset}"
        ].GET({
          params: {
            path: {
              topicTag: topicTag,
              limit: limit,
              offset: offset,
            },
          },
        });
        if (error) {
          return this.createResponse(
            `Failed to search for topics by tag: ${JSON.stringify(error)}`,
            true,
          );
        }
        return this.createResponse(`${JSON.stringify(response)}`);
      }
    
      getToolConfig(): ToolConfig {
        return {
          name: ToolName.SEARCH_TOPICS_BY_TAG,
          description:
            "List all topics in the Kafka cluster with the specified tag.",
          inputSchema: searchTopicsByTagArguments.shape,
        };
      }
    
      getRequiredEnvVars(): EnvVar[] {
        return ["SCHEMA_REGISTRY_API_KEY", "SCHEMA_REGISTRY_API_SECRET"];
      }
    
      isConfluentCloudOnly(): boolean {
        return true;
      }
    }
  • Zod input schema defining parameters for the tool: baseUrl (optional), topicTag (optional), limit (default 100, max 500), offset (default 0).
    const searchTopicsByTagArguments = z.object({
      baseUrl: z
        .string()
        .describe("The base URL of the Schema Registry REST API.")
        .url()
        .default(() => env.SCHEMA_REGISTRY_ENDPOINT ?? "")
        .optional(),
      topicTag: z.string().optional().describe("The tag we wish to search for"),
      limit: z
        .number()
        .max(500)
        .describe("The maximum number of topics to return.")
        .default(100),
      offset: z
        .number()
        .describe("The offset to start the search from. Used for pagination.")
        .default(0),
    });
  • Maps ToolName.SEARCH_TOPICS_BY_TAG to a new instance of SearchTopicsByTagHandler in the ToolFactory's handlers Map, enabling tool lookup and configuration retrieval.
    [ToolName.SEARCH_TOPICS_BY_TAG, new SearchTopicsByTagHandler()],
  • Defines the exact string name 'search-topics-by-tag' for the tool in the ToolName enum, used for registration and identification.
    SEARCH_TOPICS_BY_TAG = "search-topics-by-tag",
Behavior2/5

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

With no annotations provided, the description carries full burden but only states it's a listing operation. It doesn't disclose behavioral traits like whether it's read-only, pagination behavior beyond schema hints, rate limits, authentication needs, or what happens if no topics match the tag. The description is minimal and lacks operational context.

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

Conciseness5/5

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

The description is a single, clear sentence with zero wasted words. It's front-loaded with the core purpose and efficiently conveys the essential action and filter. Every word earns its place.

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

Completeness2/5

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

For a search tool with 4 parameters, no annotations, and no output schema, the description is insufficient. It doesn't explain the return format, error conditions, or how results are structured. While schema covers parameters well, the description lacks context about the operation's behavior and results, leaving significant gaps for an agent.

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 parameters are well-documented in the schema. The description adds minimal value by mentioning 'tag' which aligns with 'topicTag' parameter, but doesn't provide additional semantics like tag format examples or search behavior details. Baseline 3 is appropriate given high schema coverage.

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?

The description clearly states the action ('List all topics') and resource ('in the Kafka cluster') with a specific filter ('with the specified tag'). It distinguishes from generic 'list-topics' by adding tag-based filtering, though it doesn't explicitly differentiate from 'search-topics-by-name' which uses a different filter.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives like 'list-topics' or 'search-topics-by-name'. It mentions the tag filter but doesn't explain when tag-based searching is appropriate or what prerequisites might be 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

Related 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/confluentinc/mcp-confluent'

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