list_kafka_topics
Retrieve available Kafka topics from Timeplus streaming data integration to monitor and manage real-time data streams.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- mcp_timeplus/mcp_server.py:171-180 (handler)The handler function decorated with @mcp.tool() that implements the list_kafka_topics tool. It uses Confluent Kafka AdminClient to list all topics and returns an array of topic names with their partition counts.@mcp.tool() def list_kafka_topics(): logger.info("Listing all topics in the Kafka cluster") admin_client = AdminClient(json.loads(os.environ['TIMEPLUS_KAFKA_CONFIG'])) topics = admin_client.list_topics(timeout=10).topics topics_array = [] for topic, detail in topics.items(): topic_info = {"topic": topic, "partitions": len(detail.partitions)} topics_array.append(topic_info) return topics_array