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
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {},
"type": "object"
}
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 });
- src/confluent/tools/tool-factory.ts:43-43 (registration)Registration of the ListTopicsHandler instance in the ToolFactory's static handlers Map, keyed by ToolName.LIST_TOPICS.[ToolName.LIST_TOPICS, new ListTopicsHandler()],
- src/confluent/tools/tool-name.ts:2-2 (helper)Enum definition for the tool name 'list-topics' used in registration and tool config.LIST_TOPICS = "list-topics",