read-connector
Retrieve detailed information about a specific Kafka connector by providing its unique name, base URL, environment ID, and cluster ID using the MCP server.
Instructions
Get information about the connector.
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 unique name of the connector. | |
| environmentId | No | The unique identifier for the environment this resource belongs to. |
Implementation Reference
- The handle method executes the tool logic: parses input arguments, ensures environment and cluster IDs, sets REST endpoint if provided, calls the Kafka Connect REST API to GET connector details, and returns success or error response.async handle( clientManager: ClientManager, toolArguments: Record<string, unknown> | undefined, ): Promise<CallToolResult> { const { clusterId, environmentId, connectorName, baseUrl } = readConnectorArguments.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 { data: response, error } = await pathBasedClient[ "/connect/v1/environments/{environment_id}/clusters/{kafka_cluster_id}/connectors/{connector_name}" ].GET({ params: { path: { connector_name: connectorName, environment_id: environment_id, kafka_cluster_id: kafka_cluster_id, }, }, }); if (error) { return this.createResponse( `Failed to get information about connector ${connectorName}: ${JSON.stringify(error)}`, true, ); } return this.createResponse( `Connector Details for ${connectorName}: ${JSON.stringify(response)}`, ); }
- Zod input schema defining parameters for the read-connector tool: baseUrl (optional), environmentId (optional), clusterId (optional), connectorName (required).const readConnectorArguments = 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() .trim() .optional() .describe( "The unique identifier for the environment this resource belongs to.", ), clusterId: z .string() .trim() .optional() .describe("The unique identifier for the Kafka cluster."), connectorName: z .string() .trim() .nonempty() .describe("The unique name of the connector."), });
- src/confluent/tools/tool-factory.ts:52-52 (registration)Registration of the ReadConnectorHandler instance in the ToolFactory's static handlers Map under the key ToolName.READ_CONNECTOR.[ToolName.READ_CONNECTOR, new ReadConnectorHandler()],
- Enum value defining the tool name string 'read-connector' used in registration and tool config.READ_CONNECTOR = "read-connector",
- getToolConfig method providing the tool's name, description, and inputSchema for MCP tool registration.getToolConfig(): ToolConfig { return { name: ToolName.READ_CONNECTOR, description: "Get information about the connector.", inputSchema: readConnectorArguments.shape, }; }