Skip to main content
Glama

mcp-confluent

Official
by confluentinc

create-topics

Use this tool to create new Kafka topics in your Confluent cluster by specifying topic names. It integrates with Confluent Kafka and Confluent Cloud REST APIs for streamlined topic management.

Instructions

Create new topic(s) in the Kafka cluster.

Input Schema

NameRequiredDescriptionDefault
topicNamesYes

Input Schema (JSON Schema)

{ "$schema": "http://json-schema.org/draft-07/schema#", "additionalProperties": false, "properties": { "topicNames": { "items": { "description": "Names of kafka topics to create", "type": "string" }, "minItems": 1, "type": "array" } }, "required": [ "topicNames" ], "type": "object" }

Implementation Reference

  • CreateTopicsHandler class implementing the core logic for the 'create-topics' tool, including the handle method that creates Kafka topics using the admin client.
    export class CreateTopicsHandler extends BaseToolHandler { async handle( clientManager: ClientManager, toolArguments: Record<string, unknown>, ): Promise<CallToolResult> { const { topicNames } = createTopicArgs.parse(toolArguments); const success = await ( await clientManager.getAdminClient() ).createTopics({ topics: topicNames.map((name) => ({ topic: name })), }); if (!success) { return this.createResponse( `Failed to create Kafka topics: ${topicNames.join(",")}`, true, ); } return this.createResponse(`Created Kafka topics: ${topicNames.join(",")}`); } getToolConfig(): ToolConfig { return { name: ToolName.CREATE_TOPICS, description: "Create one or more Kafka topics.", inputSchema: createTopicArgs.shape, }; } getRequiredEnvVars(): EnvVar[] { return ["KAFKA_API_KEY", "KAFKA_API_SECRET", "BOOTSTRAP_SERVERS"]; } }
  • Zod input schema defining the topicNames array for the create-topics tool.
    const createTopicArgs = z.object({ topicNames: z .array(z.string().describe("Names of kafka topics to create")) .nonempty(), });
  • Registration of the CreateTopicsHandler in the ToolFactory's handlers Map under the CREATE_TOPICS key.
    [ToolName.CREATE_TOPICS, new CreateTopicsHandler()],
  • Enum definition for the tool name 'create-topics' used across the codebase.
    CREATE_TOPICS = "create-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