Skip to main content
Glama
confluentinc

mcp-confluent

Official
by confluentinc

create-flink-statement

Submit Flink SQL statements to process data streams in Confluent Cloud. Define statements with unique names, catalog, and database details for efficient execution within specified environments and compute pools.

Instructions

Make a request to create a statement.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
baseUrlNoThe base URL of the Flink REST API.
catalogNameYesThe catalog name to be used for the statement. Typically the confluent environment name.
computePoolIdNoThe id associated with the compute pool in context.
databaseNameYesThe database name to be used for the statement. Typically the Kafka cluster name.
environmentIdNoThe unique identifier for the environment.
organizationIdNoThe unique identifier for the organization.
statementYesThe raw Flink SQL text statement. Create table statements may not be necessary as topics in confluent cloud will be detected as created schemas. Make sure to show and describe tables before creating new ones.
statementNameYesThe user provided name of the resource, unique within this environment.

Implementation Reference

  • CreateFlinkStatementHandler class: core implementation of the 'create-flink-statement' tool, including the handle() method that parses inputs, ensures parameters, and POSTs to Flink SQL API to create a statement.
    export class CreateFlinkStatementHandler extends BaseToolHandler {
      async handle(
        clientManager: ClientManager,
        toolArguments: Record<string, unknown> | undefined,
      ): Promise<CallToolResult> {
        const {
          catalogName,
          databaseName,
          statement,
          statementName,
          computePoolId,
          environmentId,
          organizationId,
          baseUrl,
        } = createFlinkStatementArguments.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,
        );
        const compute_pool_id = getEnsuredParam(
          "FLINK_COMPUTE_POOL_ID",
          "Compute Pool ID is required",
          computePoolId,
        );
    
        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"
        ].POST({
          params: {
            path: {
              environment_id: environment_id,
              organization_id: organization_id,
            },
          },
          body: {
            name: statementName,
            organization_id: organization_id,
            environment_id: environment_id,
            spec: {
              compute_pool_id: compute_pool_id,
              statement: statement,
              properties: {
                // only include the catalog and database properties if they are defined
                ...(catalogName && { "sql.current-catalog": catalogName }),
                ...(databaseName && {
                  "sql.current-database": databaseName,
                }),
              },
            },
          },
        });
        if (error) {
          return this.createResponse(
            `Failed to create Flink SQL statements: ${JSON.stringify(error)}`,
            true,
          );
        }
        return this.createResponse(`${JSON.stringify(response)}`);
      }
      getToolConfig(): ToolConfig {
        return {
          name: ToolName.CREATE_FLINK_STATEMENT,
          description: "Make a request to create a statement.",
          inputSchema: createFlinkStatementArguments.shape,
        };
      }
    
      getRequiredEnvVars(): EnvVar[] {
        return ["FLINK_API_KEY", "FLINK_API_SECRET"];
      }
    
      isConfluentCloudOnly(): boolean {
        return true;
      }
    }
  • Zod input schema validating parameters for create-flink-statement tool: baseUrl, org/env/compute IDs, SQL statement, name, catalog, database.
    const createFlinkStatementArguments = z.object({
      baseUrl: z
        .string()
        .describe("The base URL of the Flink REST API.")
        .url()
        .default(() => env.FLINK_REST_ENDPOINT ?? "")
        .optional(),
      organizationId: z
        .string()
        .trim()
        .optional()
        .describe("The unique identifier for the organization."),
      environmentId: z
        .string()
        .trim()
        .optional()
        .describe("The unique identifier for the environment."),
      computePoolId: z
        .string()
        .trim()
        .optional()
        .describe("The id associated with the compute pool in context."),
      statement: z
        .string()
        .nonempty()
        .max(131072)
        .describe(
          "The raw Flink SQL text statement. Create table statements may not be necessary as topics in confluent cloud will be detected as created schemas. Make sure to show and describe tables before creating new ones.",
        ),
      statementName: z
        .string()
        .regex(
          new RegExp(
            "[a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*",
          ),
        )
        .nonempty()
        .max(100)
        .describe(
          "The user provided name of the resource, unique within this environment.",
        ),
      catalogName: z
        .string()
        .trim()
        .nonempty()
        .default(() => env.FLINK_ENV_NAME ?? "")
        .describe(
          "The catalog name to be used for the statement. Typically the confluent environment name.",
        ),
      databaseName: z
        .string()
        .trim()
        .nonempty()
        .default(() => env.FLINK_DATABASE_NAME ?? "")
        .describe(
          "The database name to be used for the statement. Typically the Kafka cluster name.",
        ),
    });
  • Registration of CreateFlinkStatementHandler in ToolFactory static handlers Map using the tool name constant.
    [ToolName.CREATE_FLINK_STATEMENT, new CreateFlinkStatementHandler()],
  • ToolName enum constant defining the string name 'create-flink-statement' for the tool.
    CREATE_FLINK_STATEMENT = "create-flink-statement",
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states 'Make a request to create a statement', implying a write/mutation operation, but doesn't disclose any behavioral traits such as permissions required, side effects, error handling, or what happens upon success. This leaves significant gaps in understanding how the tool behaves beyond the basic action.

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 extremely concise with a single sentence: 'Make a request to create a statement.' It's front-loaded and wastes no words, making it easy to parse quickly. However, this conciseness comes at the cost of completeness, as noted in other dimensions.

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

Completeness2/5

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

Given the complexity (8 parameters, 4 required, no annotations, no output schema), the description is incomplete. It doesn't explain what a 'statement' is in this context (Flink SQL), what the tool returns, or any behavioral aspects. For a creation tool with multiple parameters and no structured safety hints, this minimal description is inadequate.

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?

The description adds no parameter-specific information beyond what the input schema provides. Since schema description coverage is 100%, the baseline score is 3. The description doesn't explain parameter interactions, dependencies, or provide additional context about the 8 parameters, so it doesn't add value over the well-documented schema.

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

Purpose3/5

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

The description 'Make a request to create a statement' states a generic action but lacks specificity about what kind of statement (Flink SQL statement) and what resource it creates. It doesn't distinguish from siblings like 'create-connector' or 'create-topics', which also create resources in the same domain. The purpose is vague rather than clearly defined.

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 guidance is provided on when to use this tool versus alternatives. The description doesn't mention prerequisites, context, or comparisons to sibling tools like 'list-flink-statements' or 'delete-flink-statements'. There's no indication of when this creation is appropriate or what alternatives might exist for similar operations.

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