Skip to main content
Glama
cloudthinker-ai

Postgres MCP Pro Plus

list_schemas

Retrieve all database schemas to understand structure, manage objects, and organize PostgreSQL data efficiently.

Instructions

List all schemas in the database

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The main handler function for the 'list_schemas' tool. It queries the information_schema.schemata to retrieve schema information, categorizes them as System or User schemas, and formats the response using helper functions.
    @mcp.tool(description="List all schemas in the database")
    async def list_schemas() -> ResponseType:
        """List all schemas in the database."""
        try:
            sql_driver = await get_sql_driver()
            rows = await sql_driver.execute_query(
                """
                SELECT
                    schema_name,
                    schema_owner,
                    CASE
                        WHEN schema_name LIKE 'pg_%' THEN 'System Schema'
                        WHEN schema_name = 'information_schema' THEN 'System Information Schema'
                        ELSE 'User Schema'
                    END as schema_type
                FROM information_schema.schemata
                ORDER BY schema_type, schema_name
                """
            )
            schemas = [row.cells for row in rows] if rows else []
            return format_text_response(format_schemas_as_text(schemas))
        except Exception as e:
            logger.error(f"Error listing schemas: {e}")
            return format_error_response(str(e))
  • Helper function to format the list of schemas into a compact, readable text string, grouping user and system schemas.
    def format_schemas_as_text(schemas: list[dict]) -> str:
        """Format schemas list compactly without emojis, preserving details."""
        if not schemas:
            return "No schemas found."
    
        # Group by schema type
        system = [s for s in schemas if s.get("schema_type") in ("System Schema", "System Information Schema")]
        user = [s for s in schemas if s.get("schema_type") == "User Schema"]
    
        out: list[str] = []
        if user:
            items = [f"{s['schema_name']}(owner={s.get('schema_owner', 'N/A')})" for s in user]
            out.append("UserSchemas: " + "; ".join(items))
        if system:
            shown = system[:10]
            items = [f"{s['schema_name']}({s.get('schema_type', 'N/A')})" for s in shown]
            line = f"SystemSchemas({len(system)}): " + "; ".join(items)
            if len(system) > 10:
                line += f"; +{len(system) - 10} more"
            out.append(line)
    
        return "\n".join(out)
  • The @mcp.tool decorator registers the list_schemas function as an MCP tool.
    @mcp.tool(description="List all schemas in the database")
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. While 'List all schemas' implies a read-only operation, it doesn't specify whether this requires specific permissions, what format the output takes, whether there are pagination limits, or if there are any side effects. For a tool with zero annotation coverage, this leaves significant behavioral questions unanswered.

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 a single, efficient sentence that communicates the core functionality without any wasted words. It's appropriately sized for a simple tool with no parameters and gets straight to the point. Every word earns its place.

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

Completeness3/5

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

For a simple list operation with no parameters and no output schema, the description provides the minimum viable information about what the tool does. However, without annotations or output schema, it doesn't address important behavioral aspects like output format, permissions, or limitations. Given the simplicity of the tool, the description is adequate but leaves room for improvement in behavioral transparency.

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 tool has zero parameters, and schema description coverage is 100% (though trivial since there are no parameters). The description appropriately doesn't discuss parameters since none exist. It correctly focuses on what the tool does rather than trying to explain non-existent inputs.

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 verb ('List') and resource ('all schemas in the database'), making the purpose immediately understandable. It doesn't explicitly differentiate from sibling tools like 'list_objects' or 'get_object_details', but the specificity of 'schemas' provides some implicit distinction. This is clear but lacks explicit sibling differentiation.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. With siblings like 'list_objects' and 'get_object_details' that might overlap in functionality, there's no indication of when this specific tool is appropriate or what makes it different. The description is purely functional without contextual usage information.

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/cloudthinker-ai/postgres-mcp-pro-plus'

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