Skip to main content
Glama
confluentinc

mcp-confluent

Official
by confluentinc

list-flink-statements

Retrieve and manage a sorted, filtered, and paginated list of Flink SQL statements using REST API, enabling precise control over statement queries and data.

Instructions

Retrieve a sorted, filtered, paginated list of all statements.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
baseUrlNoThe base URL of the Flink REST API.
computePoolIdNoFilter the results by exact match for compute_pool.
environmentIdNoThe unique identifier for the environment.
labelSelectorNoA comma-separated label selector to filter the statements.
organizationIdNoThe unique identifier for the organization.
pageSizeNoA pagination size for collection requests.
pageTokenNoAn opaque pagination token for collection requests.

Implementation Reference

  • The ListFlinkStatementsHandler class, extending BaseToolHandler, contains the core execution logic in its `handle` method, which parses arguments, makes API calls to list Flink statements, and returns the result.
    export class ListFlinkStatementsHandler extends BaseToolHandler {
      async handle(
        clientManager: ClientManager,
        toolArguments: Record<string, unknown> | undefined,
      ): Promise<CallToolResult> {
        const {
          pageSize,
          computePoolId,
          environmentId,
          labelSelector,
          organizationId,
          pageToken,
          baseUrl,
        } = listFlinkStatementsArguments.parse(toolArguments);
        const organization_id = getEnsuredParam(
          "FLINK_ORG_ID",
          "Organization ID is required",
          organizationId,
        );
        const environment_id = getEnsuredParam(
          "FLINK_ENV_ID",
          "Environment ID is required",
          environmentId,
        );
    
        if (baseUrl !== undefined && baseUrl !== "") {
          clientManager.setConfluentCloudFlinkEndpoint(baseUrl);
        }
    
        const pathBasedClient = wrapAsPathBasedClient(
          clientManager.getConfluentCloudFlinkRestClient(),
        );
        const { data: response, error } = await pathBasedClient[
          "/sql/v1/organizations/{organization_id}/environments/{environment_id}/statements"
        ].GET({
          params: {
            path: {
              organization_id: organization_id,
              environment_id: environment_id,
            },
            query: {
              "spec.compute_pool_id": computePoolId,
              page_size: pageSize,
              page_token: pageToken,
              label_selector: labelSelector,
            },
          },
        });
        if (error) {
          return this.createResponse(
            `Failed to list Flink SQL statements: ${JSON.stringify(error)}`,
            true,
          );
        }
        return this.createResponse(`${JSON.stringify(response)}`);
      }
      getToolConfig(): ToolConfig {
        return {
          name: ToolName.LIST_FLINK_STATEMENTS,
          description:
            "Retrieve a sorted, filtered, paginated list of all statements.",
          inputSchema: listFlinkStatementsArguments.shape,
        };
      }
    
      getRequiredEnvVars(): EnvVar[] {
        return ["FLINK_API_KEY", "FLINK_API_SECRET"];
      }
    
      isConfluentCloudOnly(): boolean {
        return true;
      }
    }
  • Zod schema defining the input parameters for the list-flink-statements tool, including baseUrl, organizationId, environmentId, computePoolId, pageSize, pageToken, and labelSelector.
    const listFlinkStatementsArguments = z.object({
      baseUrl: z
        .string()
        .describe("The base URL of the Flink REST API.")
        .url()
        .default(() => env.FLINK_REST_ENDPOINT ?? "")
        .optional(),
      organizationId: z
        .string()
        .optional()
        .describe("The unique identifier for the organization."),
      environmentId: z
        .string()
        .optional()
        .describe("The unique identifier for the environment."),
      computePoolId: z
        .string()
        .optional()
        .default(() => env.FLINK_COMPUTE_POOL_ID ?? "")
        .describe("Filter the results by exact match for compute_pool."),
      pageSize: z
        .number()
        .int()
        .nonnegative()
        .max(100)
        .default(10)
        .describe("A pagination size for collection requests."),
      pageToken: z
        .string()
        .max(255)
        .optional()
        .describe("An opaque pagination token for collection requests."),
      labelSelector: z
        .string()
        .optional()
        .describe("A comma-separated label selector to filter the statements."),
    });
  • Registration of the ListFlinkStatementsHandler in the ToolFactory's handlers map using the tool name constant.
    [ToolName.LIST_FLINK_STATEMENTS, new ListFlinkStatementsHandler()],
  • Import of the ListFlinkStatementsHandler in the ToolFactory.
    import { ListFlinkStatementsHandler } from "@src/confluent/tools/handlers/flink/list-flink-statements-handler.js";
  • Definition of the tool name constant LIST_FLINK_STATEMENTS in the ToolName enum.
    LIST_FLINK_STATEMENTS = "list-flink-statements",
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 mentions sorting, filtering, and pagination traits, but lacks critical details: it doesn't specify default sort order, what happens when no filters are applied, whether results are cached, rate limits, authentication requirements, or error conditions. For a list operation with 7 parameters, this leaves significant behavioral gaps.

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 functionality ('retrieve...list of all statements') followed by key operational characteristics. Every word earns its place with zero redundancy or unnecessary elaboration.

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 list tool with 7 parameters and no output schema, the description is minimally adequate. It covers the basic operation but lacks details about return format, error handling, and behavioral constraints that would be helpful given the parameter complexity. Without annotations or output schema, more context about what the tool returns would improve completeness.

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 all 7 parameters thoroughly. The description adds minimal value beyond the schema by implying that parameters enable filtering and pagination, but doesn't provide additional semantic context about parameter interactions or usage patterns. 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 verb ('retrieve') and resource ('list of all statements') with specific operational characteristics ('sorted, filtered, paginated'). It distinguishes from siblings like 'read-flink-statement' (singular read) and 'create-flink-statement' (creation), but doesn't explicitly differentiate from other list tools like 'list-clusters' or 'list-connectors' beyond the resource type.

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?

No explicit guidance on when to use this tool versus alternatives is provided. The description mentions filtering capabilities but doesn't specify when filtering is appropriate or when other tools (like 'search-topics-by-name' for different resources) should be used instead. Usage context is implied but not articulated.

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