create_kafka_connector
Create and deploy a new Kafka connector by specifying environment, name, cluster, and configuration parameters to manage data flow between systems.
Instructions
Creates a new Kafka connector.
Args: environment: The environment name. name: The name of the connector. cluster: The cluster name where the connector will be deployed. configuration: The connector configuration as a dictionary.
Returns: The created connector object.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| environment | Yes | ||
| name | Yes | ||
| cluster | Yes | ||
| configuration | Yes |
Implementation Reference
- The main handler function for the 'create_kafka_connector' tool. It constructs a payload with name, cluster, and configuration, then sends a POST request to the Lenses API to create the Kafka connector.@mcp.tool() async def create_kafka_connector( environment: str, name: str, cluster: str, configuration: Dict[str, Any] ) -> Dict[str, Any]: """ Creates a new Kafka connector. Args: environment: The environment name. name: The name of the connector. cluster: The cluster name where the connector will be deployed. configuration: The connector configuration as a dictionary. Returns: The created connector object. """ payload = { "name": name, "cluster": cluster, "configuration": configuration } endpoint = f"/api/v1/environments/{environment}/proxy/api/kafka-connect/connectors" return await api_client._make_request("POST", endpoint, payload)
- src/lenses_mcp/server.py:29-29 (registration)Invocation of register_kafka_connectors(mcp), which defines and registers the create_kafka_connector tool (along with other Kafka connector tools) with the FastMCP server.register_kafka_connectors(mcp)
- A prompt generator registered with @mcp.prompt() to help generate instructions for creating a Kafka connector.@mcp.prompt() def generate_create_kafka_connector_prompt(name: str, cluster: str, connector_class: str, environment: str) -> str: """Create a Kafka connector with the specified configuration""" return f""" Please create a Kafka connector named '{name}' in the '{environment}' environment on cluster '{cluster}' using connector class '{connector_class}'. The connector should be configured with appropriate settings for its type. """