Skip to main content
Glama
avantifellows

Avanti Fellows PostgreSQL MCP Server

Official

list_tables

Discover available data by retrieving all tables from the Avanti Fellows PostgreSQL database, excluding system schemas, to understand database structure.

Instructions

List all tables in the database.

Returns tables from all schemas (excluding system schemas). Use this to discover what data is available. Returns: JSON array of tables with schema, name, and type

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The core handler function for the 'list_tables' MCP tool. Decorated with @mcp.tool() for automatic registration. Executes a fixed SQL query against information_schema.tables to list all non-system tables, formats results as JSON, and handles errors.
    @mcp.tool() async def list_tables() -> str: """List all tables in the database. Returns tables from all schemas (excluding system schemas). Use this to discover what data is available. Returns: JSON array of tables with schema, name, and type """ sql = """ SELECT table_schema, table_name, table_type FROM information_schema.tables WHERE table_schema NOT IN ('pg_catalog', 'information_schema') ORDER BY table_schema, table_name """ try: async with get_connection() as conn: rows = await conn.fetch(sql) results = [dict(row) for row in rows] return json.dumps(results, indent=2) except Exception as e: return json.dumps({"error": str(e)})

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/avantifellows/mcp-postgres'

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