Skip to main content
Glama

list_schemas

Retrieve all database schemas to understand database structure and organize data access for PostgreSQL databases.

Instructions

List all schemas in the database

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The list_schemas tool is defined as an async function decorated with @mcp.tool. It retrieves schemas by querying information_schema.schemata using an SQL driver.
    @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(schemas)
        except Exception as e:
            logger.error(f"Error listing schemas: {e}")
            return format_error_response(str(e))
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. It implies a read-only operation via 'List', but does not disclose safety guarantees, permissions required, pagination behavior, or what the return format contains.

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 exactly six words with no redundancy. It is front-loaded with the action and object, making it extremely efficient for an agent to parse.

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?

Given the zero-parameter simplicity, the description is minimally adequate. However, with no output schema and no annotations, it could benefit from clarifying what constitutes a 'schema' (database namespace vs object) and how results are structured.

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 contains 0 parameters with 100% coverage. Per scoring rules, 0 parameters establishes a baseline of 4. The description does not need to compensate for missing parameter documentation.

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 uses a clear verb ('List') and resource ('schemas') and specifies scope ('in the database'). However, it does not distinguish from sibling tool 'list_objects', which could confuse the agent about when to use schemas vs objects.

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 like 'list_objects' or 'get_object_details'. It states only what the tool does, not when to invoke it or prerequisites.

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/moecodeshere/mcptrial'

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