get_table_schema
Retrieve comprehensive schema details for a specific table in Supabase, including column definitions, keys, relationships, indexes, constraints, and triggers, using a low-risk read operation.
Instructions
Get detailed table structure including columns, keys, and relationships.
Returns comprehensive information about a specific table's structure:
Column definitions (names, types, constraints)
Primary key information
Foreign key relationships
Indexes
Constraints
Triggers
Parameters:
schema_name: Name of the schema (e.g., 'public', 'auth')
table: Name of the table to inspect
SAFETY: This is a low-risk read operation that can be executed in SAFE mode.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| schema_name | Yes | ||
| table | Yes |
Implementation Reference
- supabase_mcp/tools/registry.py:37-45 (registration)MCP tool registration with @mcp.tool decorator and thin handler that delegates to feature_manager.execute_tool.@mcp.tool(description=tool_manager.get_description(ToolName.GET_TABLE_SCHEMA)) # type: ignore async def get_table_schema(schema_name: str, table: str) -> QueryResult: """Get detailed table structure including columns, keys, and relationships.""" return await feature_manager.execute_tool( ToolName.GET_TABLE_SCHEMA, services_container=services_container, schema_name=schema_name, table=table, )
- Core handler function that retrieves the table schema query from query_manager and executes it.async def get_table_schema(self, container: "ServicesContainer", schema_name: str, table: str) -> QueryResult: """Get detailed table structure including columns, keys, and relationships.""" query_manager = container.query_manager query = query_manager.get_table_schema_query(schema_name, table) return await query_manager.handle_query(query)
- Helper method that delegates to SQLLoader to get the parametrized table schema query.def get_table_schema_query(self, schema_name: str, table: str) -> str: """Get a query to get the schema of a table.""" return self.sql_loader.get_table_schema_query(schema_name, table)
- Helper that loads the 'get_table_schema.sql' template and substitutes schema_name and table placeholders.def get_table_schema_query(cls, schema_name: str, table: str) -> str: """Get a query to get the schema of a table.""" query = cls.load_sql("get_table_schema") return query.replace("{schema_name}", schema_name).replace("{table}", table)
- supabase_mcp/tools/manager.py:17-17 (registration)ToolName enum definition for get_table_schema used in registration and dispatch.GET_TABLE_SCHEMA = "get_table_schema"