Skip to main content
Glama
gigapi

GigAPI MCP Server

by gigapi

list_tables

Retrieve all table names in a specified database to quickly see available data structures.

Instructions

List all tables in a database.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
databaseYes

Implementation Reference

  • The `list_tables` method on the `GigAPITools` class. This is the primary handler that calls the client and returns a dictionary with tables, success status, database name, and count.
    def list_tables(self, database: str) -> Dict[str, Any]:
        """List all tables in a database.
    
        Args:
            database: The name of the database
    
        Returns:
            List of tables
        """
        try:
            tables = self.client.list_tables(database)
            return {
                "tables": tables,
                "success": True,
                "database": database,
                "count": len(tables)
            }
        except GigAPIClientError as e:
            logger.error(f"Failed to list tables: {e}")
            return {
                "error": str(e),
                "success": False,
                "database": database,
                "tables": []
            }
  • The `list_tables` method on the `GigAPIClient` class. Executes 'SHOW TABLES' query and extracts table names from the NDJSON response.
    def list_tables(self, database: str) -> List[str]:
        """List all tables in a database.
    
        Args:
            database: Database name
    
        Returns:
            List of table names
        """
        query = "SHOW TABLES"
        response = self.execute_query(query, database)
        logger.debug(f"Raw SHOW TABLES response: {response}")
        if response.error:
            raise GigAPIClientError(f"Failed to list tables: {response.error}")
    
        # Extract table names from NDJSON results
        tables = []
        for result in response.results:
            if "table_name" in result:
                tables.append(result["table_name"])
            elif "name" in result:
                tables.append(result["name"])
            elif "tables" in result:
                tables.extend(result["tables"])
    
        return tables
  • Registration of the `list_tables` tool via `Tool.from_function(tools_instance.list_tables, name='list_tables', description='List all tables in a database.')` inside `create_tools()`.
    Tool.from_function(
        tools_instance.list_tables,
        name="list_tables",
        description="List all tables in a database.",
    ),
  • The `DatabaseInput` Pydantic model used as the schema for the `database` input parameter of `list_tables`.
    class DatabaseInput(BaseModel):
        """Input model for database operations."""
    
        database: str = Field(..., description="The name of the database")
Behavior2/5

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

With no annotations, the description must disclose behavioral traits. It only states the basic operation and does not mention potential side effects, permissions, or performance implications, which is insufficient for a tool with no annotations.

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 of 5 words with no redundancy. It is appropriately sized for the tool's simplicity and front-loads the core purpose effectively.

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?

The description is minimally adequate for a simple tool with one parameter and no output schema. However, it lacks details about return format, error behavior, and relationship to siblings, leaving some gaps in completeness.

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

Parameters1/5

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

Schema description coverage is 0%, and the description adds no meaning to the 'database' parameter. It does not specify valid values, format, or behavior if the database does not exist, failing to compensate for the lack of schema descriptions.

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 'List all tables in a database' clearly specifies the verb (list), resource (tables), and context (in a database). It effectively distinguishes from siblings like list_databases and get_table_schema, making the tool's purpose unambiguous.

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?

No guidance is provided on when to use this tool versus alternatives. For example, it does not explain when to use list_tables vs. list_databases or get_table_schema, leaving the agent to infer 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/gigapi/gigapi-mcp'

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