Skip to main content
Glama
confluentinc

mcp-confluent

Official
by confluentinc

list-topics

Retrieve a complete list of topics in your Kafka cluster using the mcp-confluent server. Simplify cluster management by accessing all available topics in one request.

Instructions

List all topics in the Kafka cluster.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • ListTopicsHandler class that extends BaseToolHandler. The handle() method lists all Kafka topics using the admin client and returns a formatted string response. Also defines tool config including schema and required env vars.
    export class ListTopicsHandler extends BaseToolHandler {
      async handle(
        clientManager: ClientManager,
        // eslint-disable-next-line @typescript-eslint/no-unused-vars
        toolArguments: Record<string, unknown>,
      ): Promise<CallToolResult> {
        const topics = await (await clientManager.getAdminClient()).listTopics();
        return this.createResponse(`Kafka topics: ${topics.join(",")}`);
      }
    
      getToolConfig(): ToolConfig {
        return {
          name: ToolName.LIST_TOPICS,
          description: "List all topics in the Kafka cluster.",
          inputSchema: listTopicArgs.shape,
        };
      }
    
      getRequiredEnvVars(): EnvVar[] {
        return ["KAFKA_API_KEY", "KAFKA_API_SECRET", "BOOTSTRAP_SERVERS"];
      }
    }
  • Zod schema for tool input arguments, which requires no parameters.
    const listTopicArgs = z.object({
      // No arguments
    });
  • Registration of the ListTopicsHandler instance in the ToolFactory's static handlers Map, keyed by ToolName.LIST_TOPICS.
    [ToolName.LIST_TOPICS, new ListTopicsHandler()],
  • Enum definition for the tool name 'list-topics' used in registration and tool config.
    LIST_TOPICS = "list-topics",

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