Skip to main content
Glama
gigapi

GigAPI MCP Server

by gigapi

get_table_schema

Retrieve table structure and metadata from GigAPI Timeseries Lake to understand data organization and relationships for effective querying.

Instructions

Get schema information for a specific table.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
input_dataYes

Implementation Reference

  • Primary handler for the get_table_schema MCP tool. Calls the client method and wraps the response with success/error handling.
    def get_table_schema(self, database: str, table: str) -> Dict[str, Any]:
        """Get table schema information.
    
        Args:
            database: The name of the database
            table: The name of the table
    
        Returns:
            Table schema information
        """
        try:
            schema = self.client.get_table_schema(database, table)
            return {
                "schema": schema,
                "success": True,
                "database": database,
                "table": table
            }
        except GigAPIClientError as e:
            logger.error(f"Failed to get table schema: {e}")
            return {
                "error": str(e),
                "success": False,
                "database": database,
                "table": table
            }
  • Tool registration in create_tools function, defining the handler lambda, name, and description for FastMCP.
    Tool.from_function(
        lambda input_data: tools_instance.get_table_schema(
            input_data["database"], input_data.get("table", "")
        ),
        name="get_table_schema",
        description="Get schema information for a specific table.",
    ),
  • Core helper function in GigAPIClient that executes the DESCRIBE SQL query to retrieve the table schema.
    def get_table_schema(self, database: str, table: str) -> List[Dict[str, Any]]:
        """Get table schema information.
    
        Args:
            database: Database name
            table: Table name
    
        Returns:
            List of column information
        """
        query = f"DESCRIBE {table}"
        response = self.execute_query(query, database)
    
        if response.error:
            raise GigAPIClientError(f"Failed to get table schema: {response.error}")
    
        return response.results
  • Adds all tools, including get_table_schema, to the FastMCP server instance.
    tools = create_tools(client)
    for tool in tools:
        mcp.add_tool(tool)

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/gigapi/gigapi-mcp'

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