Skip to main content
Glama
yawlhead91

MariaDB MCP Server

by yawlhead91

list_tables

Retrieve all table names from a MariaDB database to inspect its structure and contents.

Instructions

List all tables in a specific database.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
databaseNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The core handler function for the 'list_tables' MCP tool. It is registered using the @mcp.tool() decorator and implements the logic to list tables in a MariaDB database using the SHOW TABLES SQL command, handling optional database specification and formatting the output as a bullet list.
    @mcp.tool()
    async def list_tables(database: Optional[str] = None) -> str:
        """List all tables in a specific database."""
        try:
            if database:
                # Use the specified database
                query = f"SHOW TABLES FROM `{database}`"
            else:
                # Use current database
                query = "SHOW TABLES"
            
            results = await db_connection.execute_query(query)
            
            if not results:
                db_name = database or "current database"
                return f"No tables found in {db_name}"
            
            # Get table name from result (column name varies)
            tables = []
            for row in results:
                # The column name is usually "Tables_in_<database_name>"
                table_name = list(row.values())[0]
                tables.append(table_name)
            
            db_name = database or "current database"
            return f"Tables in {db_name} ({len(tables)}):\n" + "\n".join(f"- {table}" for table in tables)
        
        except Exception as e:
            logger.error(f"Error listing tables: {e}")
            return f"Error listing tables: {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 what the tool does but lacks critical details: whether it's read-only, if it requires authentication, how it handles the optional database parameter, pagination behavior, or error conditions. This leaves significant gaps for an agent to understand operational traits.

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, clear sentence with zero wasted words. It's front-loaded with the core purpose and appropriately sized for a simple tool, making it highly 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 tool's low complexity (one optional parameter) and the presence of an output schema (which handles return values), the description is minimally adequate. However, with no annotations and incomplete parameter guidance, it lacks depth on behavioral aspects, keeping it at a basic level of completeness.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, but the description partially compensates by implying the 'database' parameter's role ('in a specific database'). However, it doesn't explain parameter behavior (e.g., what happens if null/default is used, format expectations, or if it lists all tables across databases). With one parameter and some added meaning, this meets the baseline.

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 a specific database'), making it immediately understandable. However, it doesn't explicitly differentiate from sibling tools like 'list_databases' or 'get_table_schema', which prevents a perfect score.

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. It doesn't mention sibling tools like 'list_databases' (for listing databases) or 'get_table_schema' (for detailed table info), nor does it specify prerequisites or context for usage.

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/yawlhead91/mariadb-mcp'

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