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

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

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)})
Behavior3/5

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

With no annotations provided, the description carries the full burden. It discloses that it excludes system schemas and returns a JSON array with specific fields, which adds useful behavioral context. However, it doesn't cover aspects like rate limits, permissions, or pagination, leaving some gaps.

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?

The description is front-loaded with the core purpose in the first sentence, followed by additional context and return details in a structured way. Every sentence adds value without waste, making it highly efficient.

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?

Given the tool's low complexity (0 parameters) and the presence of an output schema, the description is complete enough for a list operation. It explains what is returned and exclusions, but could slightly improve by mentioning sibling tools for more context.

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?

The input schema has 0 parameters with 100% coverage, so no parameter documentation is needed. The description appropriately doesn't discuss parameters, and the baseline for 0 params is 4, as it avoids unnecessary details.

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

Purpose4/5

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

The description clearly states the tool's purpose with a specific verb ('List') and resource ('tables in the database'), and distinguishes it from siblings by mentioning it returns tables from all schemas. However, it doesn't explicitly differentiate from tools like 'describe_table' or 'search_columns' beyond scope.

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

Usage Guidelines3/5

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

The description provides implied usage guidance by stating 'Use this to discover what data is available,' which suggests when to use it, but doesn't explicitly mention when not to use it or name alternatives like 'search_columns' for more specific queries.

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

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