Skip to main content
Glama
lensesio

Lenses MCP Server

by lensesio

create_environment

Create a new Lenses environment for managing Kafka data across clusters. Specify name, tier (development/staging/production), and metadata to configure the environment.

Instructions

Creates a new Lenses environment.

Args: name: The name of the new environment. Must be a valid resource name (lowercase alphanumeric or hyphens, max 63 chars). display_name: The display name of the environment. If not provided, 'name' will be used. tier: The environment tier. Options: "development", "staging", "production". Default: "development". metadata: Additional metadata as key-value pairs.

Returns: The created environment object including the agent_key for setup.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYes
display_nameNo
tierNodevelopment
metadataNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function for the 'create_environment' tool. It validates inputs, constructs a payload, and makes a POST request to the Lenses API to create a new environment.
    @mcp.tool()
    async def create_environment(
        name: str,
        display_name: Optional[str] = None,
        tier: str = "development",
        metadata: Optional[Dict[str, Any]] = None
    ) -> Dict[str, Any]:
        """
        Creates a new Lenses environment.
        
        Args:
            name: The name of the new environment. Must be a valid resource name (lowercase alphanumeric or hyphens, max 63 chars).
            display_name: The display name of the environment. If not provided, 'name' will be used.
            tier: The environment tier. Options: "development", "staging", "production". Default: "development".
            metadata: Additional metadata as key-value pairs.
        
        Returns:
            The created environment object including the agent_key for setup.
        """
        if not name:
            raise ValueError("Environment name is required")
        
        # Validate name format
        if not name.replace('-', '').isalnum() or name.startswith('-') or name.endswith('-') or len(name) > 63:
            raise ValueError("Name must be lowercase alphanumeric or hyphens, not start/end with hyphens, max 63 chars")
        
        valid_tiers = ["development", "staging", "production"]
        if tier not in valid_tiers:
            raise ValueError(f"Tier must be one of: {', '.join(valid_tiers)}")
        
        payload = {
            "name": name,
            "tier": tier
        }
        
        if display_name:
            payload["display_name"] = display_name
        
        if metadata:
            payload["metadata"] = metadata
        
        return await api_client._make_request("POST", "/api/v1/environments", payload)
  • Registers the environments tools, including 'create_environment', by calling register_environments on the MCP instance.
    register_environments(mcp)
  • Imports the register_environments function used to register the 'create_environment' tool.
    from tools.environments import register_environments
  • Input schema defined by the function parameters, including types and defaults, used by FastMCP for tool schema.
    async def create_environment(
        name: str,
        display_name: Optional[str] = None,
        tier: str = "development",
        metadata: Optional[Dict[str, Any]] = None
    ) -> Dict[str, Any]:
  • The registration function that defines and registers the create_environment tool using @mcp.tool() decorator.
    def register_environments(mcp: FastMCP):
Behavior3/5

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

No annotations are provided, so the description carries the full burden. It discloses that the tool creates a new resource (implying a write operation) and returns an object with an 'agent_key' for setup, which adds useful context. However, it does not mention permissions required, rate limits, or potential side effects (e.g., if creation is irreversible or has dependencies).

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 (Args, Returns) and front-loaded purpose. Sentences are efficient, but the parameter details are somewhat lengthy; however, given the 0% schema coverage, this detail is justified and not wasteful.

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 (creation with 4 parameters) and no annotations, the description is fairly complete: it explains purpose, parameters, and return value. An output schema exists, so return details are not needed. It could improve by adding more behavioral context (e.g., permissions), but covers essentials adequately.

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

Parameters5/5

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

Schema description coverage is 0%, so the description must compensate. It provides detailed semantics for all 4 parameters: 'name' with validation rules, 'display_name' with fallback behavior, 'tier' with enum options and default, and 'metadata' as key-value pairs. This adds significant meaning beyond the basic 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 specific action ('Creates a new Lenses environment') and identifies the resource ('environment'). It distinguishes from sibling tools like 'get_environment' or 'list_environments' by specifying creation rather than retrieval, and no other sibling tools create environments.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage when a new environment is needed, but does not explicitly state when to use this tool versus alternatives (e.g., updating an existing environment or checking environment health). It mentions the return includes 'agent_key for setup', hinting at a setup context, but lacks explicit guidance on prerequisites 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

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