get_topic_partitions
Retrieve partition details for Kafka topics, including message counts and byte sizes, to monitor data distribution and performance across clusters.
Instructions
Retrieve detailed partition information including messages and bytes (v2 endpoint).
Args: environment: The environment name. topic_name: Name of the topic.
Returns: Partition details with message counts, bytes, and JMX timestamp.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| environment | Yes | ||
| topic_name | Yes |
Implementation Reference
- src/lenses_mcp/tools/topics.py:45-58 (handler)The handler function for the 'get_topic_partitions' tool. Decorated with @mcp.tool() for automatic registration within the register_topics function. It constructs an API endpoint and makes a GET request to retrieve detailed partition information including messages, bytes, and JMX timestamp.@mcp.tool() async def get_topic_partitions(environment: str, topic_name: str) -> Dict[str, Any]: """ Retrieve detailed partition information including messages and bytes (v2 endpoint). Args: environment: The environment name. topic_name: Name of the topic. Returns: Partition details with message counts, bytes, and JMX timestamp. """ endpoint = f"/api/v1/environments/{environment}/proxy/api/v2/topics/{topic_name}/partitions" return await api_client._make_request("GET", endpoint)
- src/lenses_mcp/server.py:33-33 (registration)Invocation of register_topics(mcp), which defines and registers the get_topic_partitions tool among others.register_topics(mcp)