Skip to main content
Glama
alexander-zuev

Supabase MCP Server

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

TableJSON Schema
NameRequiredDescriptionDefault
schema_nameYes
tableYes

Implementation Reference

  • 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)
  • ToolName enum definition for get_table_schema used in registration and dispatch.
    GET_TABLE_SCHEMA = "get_table_schema"

Tool Definition Quality

Score is being calculated. Check back soon.

Install Server

Other Tools

Related Tools

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/alexander-zuev/supabase-mcp-server'

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