delete-connector
Remove a specified connector from a Kafka environment using the MCP server. Ensures clean deletion and returns a success message upon completion.
Instructions
Delete an existing connector. Returns success message if deletion was successful.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| baseUrl | No | The base URL of the Kafka Connect REST API. | |
| clusterId | No | The unique identifier for the Kafka cluster. | |
| connectorName | Yes | The name of the connector to delete. | |
| environmentId | No | The unique identifier for the environment this resource belongs to. |
Implementation Reference
- DeleteConnectorHandler class that implements the core logic for the 'delete-connector' tool, including the handle method that performs the deletion via REST API.export class DeleteConnectorHandler extends BaseToolHandler { async handle( clientManager: ClientManager, toolArguments: Record<string, unknown> | undefined, ): Promise<CallToolResult> { const { clusterId, environmentId, connectorName, baseUrl } = deleteConnectorArguments.parse(toolArguments); const environment_id = getEnsuredParam( "KAFKA_ENV_ID", "Environment ID is required", environmentId, ); const kafka_cluster_id = getEnsuredParam( "KAFKA_CLUSTER_ID", "Kafka Cluster ID is required", clusterId, ); if (baseUrl !== undefined && baseUrl !== "") { clientManager.setConfluentCloudRestEndpoint(baseUrl); } const pathBasedClient = wrapAsPathBasedClient( clientManager.getConfluentCloudRestClient(), ); const { error } = await pathBasedClient[ "/connect/v1/environments/{environment_id}/clusters/{kafka_cluster_id}/connectors/{connector_name}" ].DELETE({ params: { path: { environment_id: environment_id, kafka_cluster_id: kafka_cluster_id, connector_name: connectorName, }, }, }); if (error) { return this.createResponse( `Failed to delete connector ${connectorName}: ${JSON.stringify(error)}`, true, ); } return this.createResponse( `Successfully deleted connector ${connectorName}`, ); } getToolConfig(): ToolConfig { return { name: ToolName.DELETE_CONNECTOR, description: "Delete an existing connector. Returns success message if deletion was successful.", inputSchema: deleteConnectorArguments.shape, }; } getRequiredEnvVars(): EnvVar[] { return ["CONFLUENT_CLOUD_API_KEY", "CONFLUENT_CLOUD_API_SECRET"]; } isConfluentCloudOnly(): boolean { return true; } }
- Zod input schema definition for the 'delete-connector' tool arguments.const deleteConnectorArguments = z.object({ baseUrl: z .string() .trim() .describe("The base URL of the Kafka Connect REST API.") .url() .default(() => env.CONFLUENT_CLOUD_REST_ENDPOINT ?? "") .optional(), environmentId: z .string() .optional() .describe( "The unique identifier for the environment this resource belongs to.", ), clusterId: z .string() .optional() .describe("The unique identifier for the Kafka cluster."), connectorName: z .string() .nonempty() .describe("The name of the connector to delete."), });
- src/confluent/tools/tool-factory.ts:61-61 (registration)Registration of the DeleteConnectorHandler in the ToolFactory's handlers map for the 'delete-connector' tool.[ToolName.DELETE_CONNECTOR, new DeleteConnectorHandler()],
- ToolName enum constant defining the 'delete-connector' tool name.DELETE_CONNECTOR = "delete-connector",