Skip to main content
Glama
bpamiri

CockroachDB MCP Server

by bpamiri

list_schemas

Retrieve all schema names from the current CockroachDB database to understand its structure and available data organization.

Instructions

List schemas in the current database.

Returns:
    List of schemas.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Core handler function that executes the logic to list schemas by querying information_schema.schemata, filtering system schemas and using allowed schema configuration.
    async def list_schemas(database: str | None = None) -> dict[str, Any]:
        """List schemas in a database.
    
        Args:
            database: Database name (uses current if not specified).
    
        Returns:
            List of schemas.
        """
        conn = await connection_manager.ensure_connected()
    
        try:
            async with conn.cursor() as cur:
                await cur.execute("""
                    SELECT schema_name
                    FROM information_schema.schemata
                    WHERE catalog_name = current_database()
                    ORDER BY schema_name
                """)
                rows = await cur.fetchall()
    
            schemas = []
            system_schemas = {"crdb_internal", "information_schema", "pg_catalog", "pg_extension"}
    
            for row in rows:
                schema_name = row.get("schema_name", "")
    
                # Check if allowed
                if not _is_allowed_schema(schema_name):
                    continue
    
                schemas.append(
                    {
                        "name": schema_name,
                        "is_system": schema_name in system_schemas,
                    }
                )
    
            return {
                "schemas": schemas,
                "count": len(schemas),
                "database": database or connection_manager.current_database,
            }
        except Exception as e:
            return {"status": "error", "error": str(e)}
  • MCP tool registration using @mcp.tool() decorator. Thin wrapper that calls the core handler in tables.list_schemas() and handles exceptions.
    @mcp.tool()
    async def list_schemas() -> dict[str, Any]:
        """List schemas in the current database.
    
        Returns:
            List of schemas.
        """
        try:
            return await tables.list_schemas()
        except Exception as e:
            return {"status": "error", "error": str(e)}
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the action and return type but omits critical details like whether this is a read-only operation, potential permissions required, pagination behavior, or error conditions. For a tool with zero annotation coverage, this leaves significant gaps in understanding its behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is brief and front-loaded with the core purpose in the first sentence, followed by a clear return statement. Both sentences earn their place by providing essential information without redundancy. However, the structure could be slightly improved by integrating the return detail more seamlessly.

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 tool's simplicity (0 parameters, output schema exists), the description is minimally adequate. It covers the basic action and return value, but with no annotations and multiple sibling tools, it lacks context on usage scenarios, behavioral traits, or integration with other operations like switch_database. The output schema reduces the need for return details, but overall completeness is limited.

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 0 parameters, and schema description coverage is 100%, so no parameter documentation is needed. The description correctly avoids discussing parameters, focusing instead on the tool's purpose and output. This aligns with the baseline expectation for parameterless tools.

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 ('schemas in the current database'), making the purpose unambiguous. It distinguishes from siblings like list_databases and list_tables by specifying schemas, though it doesn't explicitly contrast them. The description avoids tautology by adding meaningful context beyond the tool name.

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_databases or list_tables, nor does it mention prerequisites such as needing an active database connection. It implies usage in a database context but lacks explicit when/when-not instructions or sibling comparisons.

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/bpamiri/cockroachdb-mcp'

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