Skip to main content
Glama
startreedata

StarTree MCP Server for Apache Pinot

Official
by startreedata

create-schema

Generate and manage schemas for Apache Pinot using a structured JSON input, with options to override existing schemas or force creation when necessary.

Instructions

Create a new schema

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
forceNo
overrideNo
schemaJsonYes

Implementation Reference

  • MCP tool handler for 'create_schema'. This function is decorated with @mcp.tool decorator which registers it as an MCP tool. It delegates to the pinot_client.create_schema method.
    @mcp.tool
    def create_schema(schemaJson: str, override: bool = True, force: bool = False) -> str:
        """Create a new schema"""
        try:
            results = pinot_client.create_schema(
                schemaJson,
                override,
                force,
            )
            return json.dumps(results, indent=2)
        except Exception as e:
            return f"Error: {str(e)}"
  • Helper method in PinotClient class that performs the HTTP POST request to the Pinot controller endpoint to create a new schema.
    def create_schema(
        self,
        schemaJson: str,
        override: bool = True,
        force: bool = False,
    ) -> dict[str, Any]:
        url = f"{self.config.controller_url}/{PinotEndpoints.SCHEMAS}"
        params = {"override": str(override).lower(), "force": str(force).lower()}
        headers = self._create_auth_headers()
        headers["Content-Type"] = "application/json"
        response = requests.post(
            url,
            headers=headers,
            params=params,
            data=schemaJson,
            timeout=(self.config.connection_timeout, self.config.request_timeout),
            verify=True,
        )
        response.raise_for_status()
        try:
            return response.json()
        except requests.exceptions.JSONDecodeError:
            return {
                "status": "success",
                "message": "Schema creation request processed.",
                "response_body": response.text,
            }

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