get_table_schema
Retrieve schema details for a specific table within GigAPI MCP Server, enabling structured querying and management of timeseries data in GigAPI Timeseries Lake.
Instructions
Get schema information for a specific table.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| input_data | Yes |
Implementation Reference
- mcp_gigapi/tools.py:126-152 (handler)Main handler function in GigAPITools class that executes the get_table_schema tool logic by calling the client method and formatting 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 }
- mcp_gigapi/tools.py:241-247 (registration)Registration of the 'get_table_schema' MCP tool using FastMCP's Tool.from_function, wrapping the handler with a lambda to parse input_data.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.", ),
- mcp_gigapi/client.py:240-257 (helper)Core helper method in GigAPIClient that implements the schema retrieval by executing a 'DESCRIBE {table}' SQL query via execute_query.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