Skip to main content
Glama
lensesio

Lenses MCP Server

by lensesio

create_sql_processor

Create SQL processors to query and transform Kafka data streams across clusters using Lenses.io, with configurable deployment options.

Instructions

Creates a new SQL processor.

Args: environment: The environment name. name: The name of the SQL processor. sql: The SQL query/statement for the processor. deployment: Deployment configuration including details like mode, runners, cluster, namespace, etc. If there are no available deployment targets (Kubernetes or Connect clusters), use 'in process' mode: {{mode: "IN_PROC"}} sql_processor_id: Optional processor ID. If not provided, will be auto-generated. description: Optional description of the processor. tags: Optional list of tags for the processor.

Returns: The created SQL processor object with its ID.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
environmentYes
nameYes
sqlYes
deploymentNo
sql_processor_idNo
descriptionNo
tagsNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The core handler function for the 'create_sql_processor' MCP tool. It constructs a payload from the input parameters and makes a POST request to the Lenses API to create a new SQL processor.
    @mcp.tool()
    async def create_sql_processor(
        environment: str,
        name: str,
        sql: str,
        deployment: Dict[str, Any] = None,
        sql_processor_id: Optional[str] = None,
        description: Optional[str] = None,
        tags: Optional[List[str]] = None
    ) -> Dict[str, Any]:
        """
        Creates a new SQL processor.
        
        Args:
            environment: The environment name.
            name: The name of the SQL processor.
            sql: The SQL query/statement for the processor.
            deployment: Deployment configuration including details like mode, runners, cluster, namespace, etc.
                If there are no available deployment targets (Kubernetes or Connect clusters), use 'in process' mode: {{mode: "IN_PROC"}}
            sql_processor_id: Optional processor ID. If not provided, will be auto-generated.
            description: Optional description of the processor.
            tags: Optional list of tags for the processor.
        
        Returns:
            The created SQL processor object with its ID.
        """
        payload = {
            "name": name,
            "sql": sql
        }
        
        if sql_processor_id:
            payload["processorId"] = sql_processor_id
        if description:
            payload["description"] = description
        if deployment:
            payload["deployment"] = deployment
        if tags:
            payload["tags"] = tags
        
        endpoint = f"/api/v1/environments/{environment}/proxy/api/v2/streams"
    
        try:
            return await api_client._make_request("POST", endpoint, payload)
        except Exception as e:
            raise ToolError(f"SQL processor creation failed: {e}")
  • Top-level call to register all SQL processor tools, including 'create_sql_processor', on the MCP server instance.
    register_sql_processors(mcp)
  • Function that defines and registers the SQL processor tools using @mcp.tool() decorators, including the 'create_sql_processor' tool.
    def register_sql_processors(mcp: FastMCP):
  • Helper prompt generator for guiding the creation of SQL processors using the create_sql_processor tool.
    @mcp.prompt()
    def generate_create_sql_processor_prompt(name: str, sql: str, environment: str) -> str:
        """Create a SQL processor with the specified name and SQL query"""
        return f"""
            Please create a SQL processor named '{name}' in the '{environment}' environment
            with the following SQL query:
            
            {sql}
            
            The processor should be configured with appropriate deployment settings.
            Here is an example 'deployment' for Community Edition, which uses a local 'in process' mode: {{mode: "IN_PROC"}}
            It should be used when there are no available deployment targets (Kubernetes or Connect clusters) in the environment.
            Here is an example 'deployment' for Kubenetes: {{mode: "KUBERNETES", details: {{runners: 1, cluster: "incluster", namespace: "ai-agent"}}}}
            The settings can be determined for 'cluster' and 'namespace' with the get_deployment_targets tool call.
            """
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. While it states this is a creation operation (implying mutation), it doesn't address permissions needed, whether the operation is idempotent, what happens on conflicts, rate limits, or error conditions. The deployment parameter guidance adds some context but doesn't cover the full behavioral profile.

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 well-structured with clear sections for Args and Returns. Each sentence earns its place by providing necessary information. While not minimal, the structure helps readability. The deployment parameter explanation is appropriately detailed given its complexity.

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

Completeness4/5

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

Given the tool's complexity (7 parameters including nested objects) and the presence of an output schema (which handles return values), the description provides good coverage. It explains all parameters thoroughly and states what the tool returns. The main gaps are in behavioral aspects and usage context, but parameter documentation is comprehensive.

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 explaining all 7 parameters in plain language. It clarifies optional vs required parameters, provides deployment configuration details including the 'in process' mode fallback, and explains auto-generation behavior for sql_processor_id. This adds significant value beyond the bare schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb 'creates' and the resource 'new SQL processor', specifying exactly what the tool does. It distinguishes from sibling tools like 'get_sql_processor', 'list_sql_processors', and 'delete_sql_processor' by focusing on creation rather than retrieval or deletion.

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. It doesn't mention prerequisites, when creation is appropriate, or how it relates to sibling tools like 'execute_sql' or 'get_deployment_targets'. The deployment parameter hint about 'in process' mode is technical guidance but not usage context.

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