Skip to main content
Glama
alexander-zuev

Supabase MCP Server

get_tables

Retrieve detailed metadata, row counts, and sizes for all tables, views, and foreign tables in a specified PostgreSQL schema on Supabase. Supports safe read operations for database inspection.

Instructions

List all tables, foreign tables, and views in a schema with their sizes, row counts, and metadata.

Provides detailed information about all database objects in the specified schema:

  • Table/view names

  • Object types (table, view, foreign table)

  • Row counts

  • Size on disk

  • Column counts

  • Index information

  • Last vacuum/analyze times

Parameters:

  • schema_name: Name of the schema to inspect (e.g., 'public', 'auth', etc.)

SAFETY: This is a low-risk read operation that can be executed in SAFE mode.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
schema_nameYes

Implementation Reference

  • Primary MCP-registered handler for the 'get_tables' tool. Defines input (schema_name: str), output (QueryResult), description, and delegates to feature manager for execution.
    @mcp.tool(description=tool_manager.get_description(ToolName.GET_TABLES))  # type: ignore
    async def get_tables(schema_name: str) -> QueryResult:
        """List all tables, foreign tables, and views in a schema with their sizes, row counts, and metadata."""
        return await feature_manager.execute_tool(
            ToolName.GET_TABLES, services_container=services_container, schema_name=schema_name
        )
  • Core execution logic for get_tables: retrieves the SQL query via query_manager and executes it, performing the actual tool operation.
    async def get_tables(self, container: "ServicesContainer", schema_name: str) -> QueryResult:
        """List all tables, foreign tables, and views in a schema with their sizes, row counts, and metadata."""
        query_manager = container.query_manager
        query = query_manager.get_tables_query(schema_name)
        return await query_manager.handle_query(query)
  • Dispatch registration in FeatureManager.execute_tool that routes ToolName.GET_TABLES to the get_tables handler.
    elif tool_name == ToolName.GET_TABLES:
        return await self.get_tables(services_container, **kwargs)
  • Helper method to generate the SQL query string for listing tables in a schema by delegating to SQLLoader.
    def get_tables_query(self, schema_name: str) -> str:
        """Get a query to list all tables in a schema."""
        return self.sql_loader.get_tables_query(schema_name)
  • Helper that loads the 'get_tables.sql' template and parameterizes it with the schema_name.
    def get_tables_query(cls, schema_name: str) -> str:
        """Get a query to list all tables in a schema."""
        query = cls.load_sql("get_tables")
        return query.replace("{schema_name}", schema_name)
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