Skip to main content
Glama
startreedata

StarTree MCP Server for Apache Pinot

Official
by startreedata

index-column-details

Retrieve detailed index and column information for a specific segment in Apache Pinot tables to analyze and optimize data structure and query performance.

Instructions

Get index/column details for a segment

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
segmentNameYes
tableNameYes

Implementation Reference

  • MCP tool handler for 'index-column-details'. This function is decorated with @mcp.tool (FastMCP registration) and delegates to PinotClient.get_index_column_detail, returning JSON results.
    @mcp.tool
    def index_column_details(tableName: str, segmentName: str) -> str:
        """Get index/column details for a segment"""
        try:
            results = pinot_client.get_index_column_detail(
                tableName=tableName,
                segmentName=segmentName,
            )
            return json.dumps(results, indent=2)
        except Exception as e:
            return f"Error: {str(e)}"
  • Core implementation logic in PinotClient that fetches segment metadata details (with columns=*) via HTTP to Pinot controller endpoints for both REALTIME and OFFLINE table types.
    def get_index_column_detail(
        self,
        tableName: str,
        segmentName: str,
        params: dict[str, Any] | None = None,
    ) -> dict[str, Any]:
        for type_suffix in ["REALTIME", "OFFLINE"]:
            endpoint = PinotEndpoints.SEGMENT_DETAIL.format(
                tableName, type_suffix, segmentName
            )
            url = f"{self.config.controller_url}/{endpoint}"
            logger.debug(f"Trying to fetch index column details from: {url}")
            try:
                response = self.http_request(url)
                return response.json()
            except Exception as e:
                error_msg = (
                    f"Failed to fetch index column details for "
                    f"{tableName}_{type_suffix}/{segmentName}: {e}"
                )
                logger.error(error_msg)
                continue
        raise ValueError("Index column detail not found")
  • Defines the SEGMENT_DETAIL endpoint pattern used: 'segments/{}_{}/{}/metadata?columns=*' for fetching column details.
    class PinotEndpoints:
        QUERY_SQL = "query/sql"
        TABLES = "tables"
        SCHEMAS = "schemas"
        TABLE_SIZE = "tables/{}/size"
        SEGMENTS = "segments/{}"
        SEGMENT_METADATA = "segments/{}/metadata"
        SEGMENT_DETAIL = "segments/{}_{}/{}/metadata?columns=*"
        TABLE_CONFIG = "tableConfigs/{}"
  • Input schema defined by type hints: tableName (str), segmentName (str) -> str (JSON output).
    def index_column_details(tableName: str, segmentName: str) -> str:
        """Get index/column details for a segment"""
  • Tool description in prompt template for the AI assistant.
    5. index-column-details: Get index details for a specific column in a table

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/startreedata/mcp-pinot'

If you have feedback or need assistance with the MCP directory API, please join our Discord server