Skip to main content
Glama
lensesio

Lenses MCP Server

by lensesio

create_topic

Create a new Kafka topic with configurable partitions, replication, and settings for data streaming in Apache Kafka environments.

Instructions

Creates a new Kafka topic with optional configuration.

Args: environment: The environment name. topic_name: Topic name. partitions: Number of partitions (default: 1). replication: Replication factor (default: 1). configs: Topic configurations.

Returns: Creation result.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
environmentYes
topic_nameYes
partitionsNo
replicationNo
configsNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The @mcp.tool()-decorated handler function that implements the logic for creating a new Kafka topic by making a POST request to the API endpoint with the specified parameters.
    @mcp.tool()
    async def create_topic(
        environment: str,
        topic_name: str,
        partitions: int = 1,
        replication: int = 1,
        configs: Optional[Dict[str, str]] = None
    ) -> str:
        """
        Creates a new Kafka topic with optional configuration.
        
        Args:
            environment: The environment name.
            topic_name: Topic name.
            partitions: Number of partitions (default: 1).
            replication: Replication factor (default: 1).
            configs: Topic configurations.
        
        Returns:
            Creation result.
        """
        payload = {
            "topicName": topic_name,
            "partitions": partitions,
            "replication": replication
        }
        
        if configs:
            payload["configs"] = configs
        else:
            payload["configs"] = {}
        
        endpoint = f"/api/v1/environments/{environment}/proxy/api/topics"
        try:
            return await api_client._make_request("POST", endpoint, payload)
        except Exception as e:
            raise ToolError(f"Topic creation failed: {e}")
  • The call to register_topics(mcp) which defines and registers the create_topic tool along with other topic-related tools.
    register_topics(mcp)
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 this is a creation operation but doesn't mention permissions required, whether the topic creation is idempotent, potential side effects, or error conditions. The description lacks critical behavioral context for a mutation tool.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is efficiently structured with a clear opening statement followed by organized Args and Returns sections. Every sentence serves a purpose, though the 'Returns' line is somewhat vague and could be more specific about what 'Creation result' entails.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a 5-parameter mutation tool with no annotations, the description provides basic parameter information but lacks crucial behavioral context. The existence of an output schema helps, but the description doesn't adequately address permissions, side effects, or error handling that would be essential for safe tool invocation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 0% schema description coverage, the description compensates well by listing all 5 parameters with brief explanations. It clarifies that 'partitions' and 'replication' have defaults, and 'configs' are optional topic configurations, adding meaningful context beyond the bare schema.

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 ('Creates a new Kafka topic') and resource ('Kafka topic'), making the purpose immediately understandable. However, it doesn't explicitly differentiate from sibling tools like 'create_topic_with_schema', which handles similar functionality with additional schema capabilities.

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_with_schema' or 'update_topic_config'. It mentions optional configuration but doesn't specify scenarios where this tool is preferred or prerequisites for successful invocation.

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

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/lensesio/lenses-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server