Skip to main content
Glama
confluentinc

mcp-confluent

Official
by confluentinc

add-tags-to-topic

Assign existing tags to Kafka topics in Confluent Cloud, enabling organized and efficient topic management. Specify tag assignments directly through structured input.

Instructions

Assign existing tags to Kafka topics in Confluent Cloud.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
baseUrlNoThe base URL of the Schema Registry REST API.
tagAssignmentsYesArray of tag assignments to create

Implementation Reference

  • AddTagToTopicHandler class extending BaseToolHandler, containing the handle() method that executes the tool logic by assigning tags to topics using the Schema Registry API.
    export class AddTagToTopicHandler extends BaseToolHandler {
      async handle(
        clientManager: ClientManager,
        toolArguments: Record<string, unknown>,
      ): Promise<CallToolResult> {
        const { tagAssignments, baseUrl } =
          addTagToTopicArguments.parse(toolArguments);
    
        if (baseUrl !== undefined && baseUrl !== "") {
          clientManager.setConfluentCloudSchemaRegistryEndpoint(baseUrl);
        }
    
        const pathBasedClient = wrapAsPathBasedClient(
          clientManager.getConfluentCloudSchemaRegistryRestClient(),
        );
    
        const { data: response, error } = await pathBasedClient[
          "/catalog/v1/entity/tags"
        ].POST({
          body: tagAssignments,
        });
    
        if (error) {
          return this.createResponse(
            `Failed to assign tag: ${JSON.stringify(error)}`,
            true,
          );
        }
        return this.createResponse(
          `Successfully assigned tag: ${JSON.stringify(response)}`,
        );
      }
    
      getToolConfig(): ToolConfig {
        return {
          name: ToolName.ADD_TAGS_TO_TOPIC,
          description: "Assign existing tags to Kafka topics in Confluent Cloud.",
          inputSchema: addTagToTopicArguments.shape,
        };
      }
    
      getRequiredEnvVars(): EnvVar[] {
        return ["SCHEMA_REGISTRY_API_KEY", "SCHEMA_REGISTRY_API_SECRET"];
      }
    
      isConfluentCloudOnly(): boolean {
        return true;
      }
    }
  • Zod input schema definition for the add-tags-to-topic tool arguments.
    const addTagToTopicArguments = z.object({
      baseUrl: z
        .string()
        .describe("The base URL of the Schema Registry REST API.")
        .url()
        .default(() => env.SCHEMA_REGISTRY_ENDPOINT ?? "")
        .optional(),
      tagAssignments: z
        .array(
          z.object({
            entityType: z.string().default("kafka_topic"),
            entityName: z
              .string()
              .describe(
                `Qualified name of the entity. If not provided, you can obtain it from using the ${ToolName.SEARCH_TOPICS_BY_NAME} tool. example: "lsrc-g2p81:lkc-xq8k7g:my-flights"`,
              ),
            typeName: z.string().describe("Name of the tag to assign"),
          }),
        )
        .nonempty()
        .describe("Array of tag assignments to create"),
    });
  • Registration of the AddTagToTopicHandler in the ToolFactory's static handlers Map using the tool name.
    [ToolName.ADD_TAGS_TO_TOPIC, new AddTagToTopicHandler()],
  • Enum definition for the tool name constant ADD_TAGS_TO_TOPIC.
    ADD_TAGS_TO_TOPIC = "add-tags-to-topic",
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It states 'Assign existing tags', implying a mutation operation, but doesn't mention permissions required, whether tags must pre-exist, error handling, or what happens on conflicts. For a mutation tool with zero annotation coverage, this leaves significant gaps in understanding behavior.

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, efficient sentence that directly states the tool's purpose without any wasted words. It's appropriately sized and front-loaded, making it easy to understand at a glance.

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 mutation tool with no annotations and no output schema, the description is incomplete. It doesn't cover behavioral aspects like permissions, error conditions, or what the tool returns. Given the complexity of tag assignment operations and lack of structured data, more context is needed for effective use.

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 the schema already documents both parameters thoroughly. The description adds no additional parameter semantics beyond what's in the schema (e.g., it doesn't explain tag assignment constraints or format details). Baseline 3 is appropriate when schema does the heavy lifting.

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 ('Assign existing tags') and target resource ('Kafka topics in Confluent Cloud'), providing a specific verb+resource combination. However, it doesn't explicitly differentiate from sibling tools like 'create-topic-tags' or 'remove-tag-from-entity', which would require more specific context about when to use each.

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 'create-topic-tags' or 'remove-tag-from-entity'. It mentions obtaining entity names from 'search-topics-by-name' in the schema, but this isn't part of the description itself, so it offers no explicit usage 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