delete-flink-statements
Remove specific Flink statements by sending requests to the Flink REST API, using organization, environment, and statement identifiers.
Instructions
Make a request to delete a statement.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| baseUrl | No | The base URL of the Flink REST API. | |
| environmentId | No | The unique identifier for the environment. | |
| organizationId | No | The unique identifier for the organization. | |
| statementName | Yes | The user provided name of the resource, unique within this environment. |
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"baseUrl": {
"default": "",
"description": "The base URL of the Flink REST API.",
"format": "uri",
"type": "string"
},
"environmentId": {
"description": "The unique identifier for the environment.",
"type": "string"
},
"organizationId": {
"description": "The unique identifier for the organization.",
"type": "string"
},
"statementName": {
"description": "The user provided name of the resource, unique within this environment.",
"maxLength": 100,
"minLength": 1,
"pattern": "[a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*",
"type": "string"
}
},
"required": [
"statementName"
],
"type": "object"
}
Implementation Reference
- The DeleteFlinkStatementHandler class implements the core logic for the 'delete-flink-statements' tool. It parses input arguments, ensures required parameters, makes a DELETE request to the Confluent Cloud Flink SQL API to delete the specified statement, and returns the status.export class DeleteFlinkStatementHandler extends BaseToolHandler { async handle( clientManager: ClientManager, toolArguments: Record<string, unknown> | undefined, ): Promise<CallToolResult> { const { statementName, environmentId, organizationId, baseUrl } = deleteFlinkStatementArguments.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 { response, error } = await pathBasedClient[ "/sql/v1/organizations/{organization_id}/environments/{environment_id}/statements/{statement_name}" ].DELETE({ params: { path: { organization_id: organization_id, environment_id: environment_id, statement_name: statementName, }, }, }); if (error) { return this.createResponse( `Failed to delete Flink SQL statement: ${JSON.stringify(error)}`, true, ); } return this.createResponse( `Flink SQL Statement Deletion Status Code: ${response?.status}`, ); } getToolConfig(): ToolConfig { return { name: ToolName.DELETE_FLINK_STATEMENTS, description: "Make a request to delete a statement.", inputSchema: deleteFlinkStatementArguments.shape, }; } getRequiredEnvVars(): EnvVar[] { return ["FLINK_API_KEY", "FLINK_API_SECRET"]; } isConfluentCloudOnly(): boolean { return true; } }
- Zod input schema defining the parameters for the delete-flink-statements tool: baseUrl (optional Flink REST endpoint), organizationId (optional), environmentId (optional), and statementName (required, with regex validation).const deleteFlinkStatementArguments = z.object({ baseUrl: z .string() .trim() .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."), 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.", ), });
- src/confluent/tools/tool-factory.ts:50-50 (registration)Registration of the DeleteFlinkStatementHandler in the ToolFactory's handlers Map under the key ToolName.DELETE_FLINK_STATEMENTS.[ToolName.DELETE_FLINK_STATEMENTS, new DeleteFlinkStatementHandler()],
- src/confluent/tools/tool-factory.ts:15-15 (registration)Import of the DeleteFlinkStatementHandler class in tool-factory.ts for registration.import { DeleteFlinkStatementHandler } from "@src/confluent/tools/handlers/flink/delete-flink-statement-handler.js";
- Enum constant defining the tool name 'delete-flink-statements'.DELETE_FLINK_STATEMENTS = "delete-flink-statements",