list-connectors
Retrieve active Kafka connector names via the Kafka Connect REST API to simplify specific connector read requests on the mcp-confluent server.
Instructions
Retrieve a list of "names" of the active connectors. You can then make a read request for a specific connector by name.
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. | |
| environmentId | No | The unique identifier for the environment this resource belongs to. |
Implementation Reference
- The handle method of ListConnectorsHandler class, which executes the logic to list active connectors using the Confluent Cloud REST API.async handle( clientManager: ClientManager, toolArguments: Record<string, unknown> | undefined, ): Promise<CallToolResult> { const { clusterId, environmentId, baseUrl } = listConnectorArguments.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" ].GET({ params: { path: { environment_id: environment_id, kafka_cluster_id: kafka_cluster_id, }, }, }); if (error) { return this.createResponse( `Failed to list Confluent Cloud connectors for ${clusterId}: ${JSON.stringify(error)}`, true, ); } return this.createResponse( `Active Connectors: ${JSON.stringify(response?.join(","))}`, ); }
- Zod schema defining the input arguments for the list-connectors tool: baseUrl, environmentId, clusterId.const listConnectorArguments = 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."), });
- src/confluent/tools/tool-factory.ts:51-51 (registration)Registration of the ListConnectorsHandler in the ToolFactory's static handlers Map using the tool name.[ToolName.LIST_CONNECTORS, new ListConnectorsHandler()],
- Enum definition for the tool name 'list-connectors' used in registration and configuration.LIST_CONNECTORS = "list-connectors",
- getToolConfig method providing the tool name, description, and input schema for MCP tool registration.getToolConfig(): ToolConfig { return { name: ToolName.LIST_CONNECTORS, description: 'Retrieve a list of "names" of the active connectors. You can then make a read request for a specific connector by name.', inputSchema: listConnectorArguments.shape, }; }