Skip to main content
Glama
confluentinc

mcp-confluent

Official
by confluentinc

alter-topic-config

Modify Kafka topic configurations in Confluent Cloud by setting or deleting parameters. Specify the topic name, cluster ID, and desired configurations to update.

Instructions

Alter topic configuration in Confluent Cloud.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
baseUrlNoThe base URL of the Confluent Cloud Kafka REST API.
clusterIdNoThe unique identifier for the Kafka cluster.
topicConfigsYes
topicNameYesName of the topic to alter
validateOnlyNo

Implementation Reference

  • AlterTopicConfigHandler class implementing the core tool execution logic via the handle() method, using Confluent Cloud Kafka REST API to alter topic configs.
    export class AlterTopicConfigHandler extends BaseToolHandler {
      async handle(
        clientManager: ClientManager,
        toolArguments: Record<string, unknown>,
      ): Promise<CallToolResult> {
        const { clusterId, topicName, topicConfigs, validateOnly, baseUrl } =
          alterTopicConfigArguments.parse(toolArguments);
        const kafka_cluster_id = getEnsuredParam(
          "KAFKA_CLUSTER_ID",
          "Kafka Cluster ID is required",
          clusterId,
        );
    
        if (baseUrl !== undefined && baseUrl !== "") {
          clientManager.setConfluentCloudKafkaRestEndpoint(baseUrl);
        }
    
        const pathBasedClient = wrapAsPathBasedClient(
          clientManager.getConfluentCloudKafkaRestClient(),
        );
    
        const { data: response, error } = await pathBasedClient[
          `/kafka/v3/clusters/${kafka_cluster_id}/topics/${topicName}/configs:alter`
        ].POST({
          body: {
            data: topicConfigs,
            validate_only: validateOnly,
          },
        });
    
        if (error) {
          return this.createResponse(
            `Failed to alter topic config: ${JSON.stringify(error)}`,
            true,
          );
        }
    
        return this.createResponse(
          `Successfully altered topic config: ${JSON.stringify(response)}`,
        );
      }
    
      getToolConfig(): ToolConfig {
        return {
          name: ToolName.ALTER_TOPIC_CONFIG,
          description: "Alter topic configuration in Confluent Cloud.",
          inputSchema: alterTopicConfigArguments.shape,
        };
      }
    
      getRequiredEnvVars(): EnvVar[] {
        return ["KAFKA_API_KEY", "KAFKA_API_SECRET", "BOOTSTRAP_SERVERS"];
      }
    
      isConfluentCloudOnly(): boolean {
        return true;
      }
    }
  • Zod input schema validation for the tool arguments including baseUrl, clusterId, topicName, topicConfigs array, and validateOnly.
    const alterTopicConfigArguments = z.object({
      baseUrl: z
        .string()
        .describe("The base URL of the Confluent Cloud Kafka REST API.")
        .url()
        .default(() => env.KAFKA_REST_ENDPOINT ?? "")
        .optional(),
      clusterId: z
        .string()
        .optional()
        .describe("The unique identifier for the Kafka cluster."),
      topicName: z.string().describe("Name of the topic to alter").nonempty(),
      topicConfigs: z
        .array(
          z.object({
            name: z.string().describe("Configuration parameter name").nonempty(),
            value: z.string().describe("Configuration parameter value"),
            operation: z.enum(["SET", "DELETE"]).describe("Operation type"),
          }),
        )
        .nonempty(),
      validateOnly: z.boolean().default(false),
    });
  • Registration of the AlterTopicConfigHandler instance in the ToolFactory's static handlers Map using the tool name enum.
    [ToolName.ALTER_TOPIC_CONFIG, new AlterTopicConfigHandler()],
  • Enum definition ToolName.ALTER_TOPIC_CONFIG = "alter-topic-config" used for tool identification and registration.
    ALTER_TOPIC_CONFIG = "alter-topic-config",
  • Import statement for the AlterTopicConfigHandler in ToolFactory.
    import { AlterTopicConfigHandler } from "@src/confluent/tools/handlers/kafka/alter-topic-config.js";
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states 'Alter' implying a mutation, but doesn't mention permissions required, whether changes are reversible, potential side effects, or rate limits. This leaves significant gaps for a tool that modifies configurations, making it inadequate for safe usage.

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, direct sentence with zero waste—it states the tool's purpose without unnecessary words. It's appropriately sized and front-loaded, making it easy to parse quickly.

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?

Given the tool's complexity (5 parameters, mutation operation, no output schema), the description is insufficient. It lacks details on behavior, error handling, or output expectations, and with no annotations to fill gaps, it doesn't provide enough context for reliable use in a system like Confluent Cloud.

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?

The description adds no parameter-specific information beyond what's in the schema. With 60% schema description coverage, the schema documents most parameters well (e.g., 'topicName', 'topicConfigs'), but the description doesn't compensate for gaps or provide additional context like examples or constraints. This meets the baseline for moderate 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 ('Alter') and resource ('topic configuration in Confluent Cloud'), making the purpose immediately understandable. However, it doesn't distinguish this tool from similar siblings like 'create-topics' or 'delete-topics' that also modify topics, missing explicit differentiation.

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?

No guidance is provided on when to use this tool versus alternatives. For example, it doesn't specify if this is for updating existing topics versus creating new ones (contrasted with 'create-topics'), or how it relates to other configuration tools. The description offers only a basic statement without context or exclusions.

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