Skip to main content
Glama
confluentinc

mcp-confluent

Official
by confluentinc

read-environment

Retrieve detailed information about a specific environment in Confluent Cloud by providing its unique ID. Integrates with the Confluent Cloud REST API for streamlined environment management.

Instructions

Get details of a specific environment by ID

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
baseUrlNoThe base URL of the Confluent Cloud REST API.
environmentIdYesThe ID of the environment to retrieve

Implementation Reference

  • The handle method of ReadEnvironmentHandler, which parses arguments, calls the Confluent Cloud REST API to retrieve the environment by ID, validates the response, formats details, and returns the result.
      async handle(
        clientManager: ClientManager,
        toolArguments: Record<string, unknown>,
      ): Promise<CallToolResult> {
        const { baseUrl, environmentId } =
          readEnvironmentArguments.parse(toolArguments);
    
        try {
          if (baseUrl !== undefined && baseUrl !== "") {
            clientManager.setConfluentCloudRestEndpoint(baseUrl);
          }
    
          const pathBasedClient = wrapAsPathBasedClient(
            clientManager.getConfluentCloudRestClient(),
          );
    
          const { data: response, error } = await pathBasedClient[
            "/org/v2/environments/{id}"
          ].GET({
            params: {
              path: {
                id: environmentId,
              },
            },
          });
    
          if (error) {
            logger.error({ error }, "API Error");
            return this.createResponse(
              `Failed to fetch environment: ${JSON.stringify(error)}`,
              true,
              { error },
            );
          }
    
          try {
            const validatedEnvironment = environmentSchema.parse(
              response,
            ) as Environment;
            const environmentDetails = {
              api_version: validatedEnvironment.api_version,
              kind: validatedEnvironment.kind,
              id: validatedEnvironment.id,
              name: validatedEnvironment.display_name,
              metadata: {
                created_at: validatedEnvironment.metadata.created_at,
                updated_at: validatedEnvironment.metadata.updated_at,
                deleted_at: validatedEnvironment.metadata.deleted_at,
                resource_name: validatedEnvironment.metadata.resource_name,
                self: validatedEnvironment.metadata.self,
              },
              stream_governance_package:
                validatedEnvironment.stream_governance_config?.package,
            };
    
            const formattedDetails = `
    Environment: ${environmentDetails.name}
      API Version: ${environmentDetails.api_version}
      Kind: ${environmentDetails.kind}
      ID: ${environmentDetails.id}
      Resource Name: ${environmentDetails.metadata.resource_name}
      Self Link: ${environmentDetails.metadata.self}
      Created At: ${environmentDetails.metadata.created_at}
      Updated At: ${environmentDetails.metadata.updated_at}${environmentDetails.metadata.deleted_at ? `\n  Deleted At: ${environmentDetails.metadata.deleted_at}` : ""}${environmentDetails.stream_governance_package ? `\n  Stream Governance Package: ${environmentDetails.stream_governance_package}` : ""}
    `;
    
            return this.createResponse(
              `Successfully retrieved environment:\n${formattedDetails}`,
              false,
              { environment: environmentDetails },
            );
          } catch (validationError) {
            logger.error(
              { error: validationError },
              "Environment validation error",
            );
            return this.createResponse(
              `Invalid environment data: ${validationError instanceof Error ? validationError.message : String(validationError)}`,
              true,
              { error: validationError },
            );
          }
        } catch (error) {
          logger.error({ error }, "Error in ReadEnvironmentHandler");
          return this.createResponse(
            `Failed to fetch environment: ${error instanceof Error ? error.message : String(error)}`,
            true,
            { error: error instanceof Error ? error.message : String(error) },
          );
        }
      }
  • Zod schema defining the input parameters for the read-environment tool: baseUrl (optional) and environmentId (required).
    const readEnvironmentArguments = z.object({
      baseUrl: z
        .string()
        .describe("The base URL of the Confluent Cloud REST API.")
        .url()
        .default(() => env.CONFLUENT_CLOUD_REST_ENDPOINT ?? "")
        .optional(),
      environmentId: z
        .string()
        .describe("The ID of the environment to retrieve")
        .nonempty(),
    });
  • Registration of the read-environment tool in the ToolFactory's static handlers Map, associating ToolName.READ_ENVIRONMENT with a new instance of ReadEnvironmentHandler.
    [ToolName.READ_ENVIRONMENT, new ReadEnvironmentHandler()],
  • Definition of the ToolName enum value for 'read-environment' used in registration and tool configuration.
    READ_ENVIRONMENT = "read-environment",
  • Tool configuration method providing the name, description, and input schema for the read-environment tool.
    getToolConfig(): ToolConfig {
      return {
        name: ToolName.READ_ENVIRONMENT,
        description: "Get details of a specific environment by ID",
        inputSchema: readEnvironmentArguments.shape,
      };
    }
Behavior2/5

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

With no annotations provided, the description carries full burden but only states it retrieves details without disclosing behavioral traits. It doesn't mention if this is a read-only operation (implied but not explicit), authentication needs, rate limits, error handling, or what happens if the ID is invalid. For a tool with zero annotation coverage, this is a significant gap in transparency.

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 front-loads the core purpose ('Get details of a specific environment by ID') with zero wasted words. It's appropriately sized for a simple retrieval tool, making it easy to parse quickly.

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?

Given the tool's low complexity (simple read operation), 100% schema coverage, and no output schema, the description is minimally adequate. However, it lacks context on what 'details' include, which could be critical for an agent to understand the return value. With no annotations and no output schema, more completeness would be beneficial for a read tool.

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%, with both parameters ('baseUrl' and 'environmentId') fully documented in the schema. The description adds no additional meaning beyond implying 'environmentId' is used to identify the target, which is already clear from the schema. Baseline 3 is appropriate as the 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 ('Get details') and resource ('a specific environment by ID'), making the purpose unambiguous. It distinguishes from the sibling 'list-environments' by focusing on a single environment rather than listing multiple. However, it doesn't specify what 'details' include (e.g., configuration, status, metadata), which prevents a perfect score.

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 you need details of a known environment ID, contrasting with 'list-environments' for browsing. However, it lacks explicit guidance on when to use this versus alternatives like 'search-topics-by-tag' for related resources, or prerequisites such as needing the environment ID first. No exclusions or clear alternatives are stated.

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