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"
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden and does well by explicitly stating 'This is a low-risk read operation that can be executed in SAFE mode.' It discloses safety profile and operational mode, though it could add more about rate limits, permissions needed, or response format.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Perfectly structured with purpose statement, bulleted return details, parameter section, and safety note. Every sentence earns its place, and information is front-loaded with the core purpose first.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a read operation with 2 parameters and no output schema, the description provides good coverage of purpose, parameters, and safety. It could benefit from more detail about the return format or example output, but given the context signals, it's mostly complete.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate. It provides clear semantic meaning for both parameters with examples (schema_name: 'public', 'auth') and clarifies that 'table' is the specific table to inspect. This adds significant value beyond the bare schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb 'Get' and resource 'detailed table structure', specifying what information is returned (columns, keys, relationships). It distinguishes from sibling tools like get_schemas and get_tables by focusing on detailed structural metadata rather than lists of objects.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage context through the parameter descriptions and safety note, but doesn't explicitly state when to use this tool versus alternatives like get_tables or execute_postgresql. It provides clear context for inspecting table structure but lacks explicit exclusions or named alternatives.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

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