Skip to main content
Glama
K02D

MCP Tabular Data Analysis Server

by K02D

list_tables

Retrieve table names and schemas from a SQLite database to understand its structure before analysis.

Instructions

List all tables in a SQLite database.

Args:
    db_path: Path to SQLite database file

Returns:
    Dictionary containing table names and their schemas

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
db_pathYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The @mcp.tool()-decorated function implementing the list_tables tool. Connects to SQLite DB, queries sqlite_master for table names, fetches PRAGMA table_info for schema and COUNT(*) for row counts per table.
    @mcp.tool()
    def list_tables(db_path: str) -> dict[str, Any]:
        """
        List all tables in a SQLite database.
        
        Args:
            db_path: Path to SQLite database file
        
        Returns:
            Dictionary containing table names and their schemas
        """
        path = _resolve_path(db_path)
        if not path.exists():
            raise FileNotFoundError(
                f"Database not found: {db_path}\n"
                f"Resolved to: {path}\n"
                f"Project root: {_PROJECT_ROOT}"
            )
        
        conn = sqlite3.connect(str(path))
        try:
            # Get table names
            tables = pd.read_sql_query(
                "SELECT name FROM sqlite_master WHERE type='table'", conn
            )
            
            result = {"tables": {}}
            
            for table_name in tables["name"]:
                # Get schema for each table
                schema = pd.read_sql_query(
                    f"PRAGMA table_info({table_name})", conn
                )
                
                # Get row count
                count = pd.read_sql_query(
                    f"SELECT COUNT(*) as cnt FROM {table_name}", conn
                ).iloc[0]["cnt"]
                
                result["tables"][table_name] = {
                    "row_count": int(count),
                    "columns": [
                        {
                            "name": row["name"],
                            "type": row["type"],
                            "nullable": not row["notnull"],
                            "primary_key": bool(row["pk"]),
                        }
                        for _, row in schema.iterrows()
                    ]
                }
            
            return result
        finally:
            conn.close()
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 states the tool lists tables and returns a dictionary with names and schemas, which covers basic behavior. However, it lacks details on error handling, permissions, or performance characteristics that would be useful for a database operation.

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 structured 'Args' and 'Returns' sections. Every sentence adds value without redundancy, making it efficient and easy to parse.

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 (one parameter) and the presence of an output schema (implied by 'Returns' statement), the description is reasonably complete. It covers purpose, input, and output, though it could benefit from more behavioral context given the lack of annotations.

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 description adds meaningful context for the single parameter 'db_path' by specifying it as 'Path to SQLite database file', which clarifies its purpose beyond the schema's generic 'string' type. With 0% schema description coverage, this compensates adequately, though it doesn't detail format constraints like file existence or accessibility.

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

Purpose5/5

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

The description clearly states the specific action ('List all tables') and resource ('in a SQLite database'), distinguishing it from siblings like 'list_data_files' or 'query_sqlite'. It precisely defines the tool's scope without ambiguity.

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 implies usage when needing to enumerate tables in a SQLite database, but provides no explicit guidance on when to use this tool versus alternatives like 'describe_dataset' or 'query_sqlite'. No exclusions or prerequisites are mentioned.

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/K02D/mcp-tabular'

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