Skip to main content
Glama
gigapi

GigAPI MCP Server

by gigapi

list_tables

Retrieve all database tables to explore available data structures and identify relevant datasets for analysis.

Instructions

List all tables in a database.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
databaseYes

Implementation Reference

  • The primary MCP tool handler for 'list_tables'. It invokes the client's list_tables method, formats the response with success status, count, and handles errors.
    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": []
            }
  • Registration of the 'list_tables' tool instance using FastMCP's Tool.from_function, binding it to the GigAPITools.list_tables method.
    Tool.from_function(
        tools_instance.list_tables,
        name="list_tables",
        description="List all tables in a database.",
    ),
  • Helper method in GigAPIClient that executes a 'SHOW TABLES' SQL query, parses NDJSON results to extract table names, and returns a list of strings.
    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
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 mentions listing tables but doesn't cover important aspects like whether this is a read-only operation, what permissions are needed, how results are formatted, or if there are limitations (e.g., pagination). This leaves significant gaps for a tool that interacts with databases.

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, efficient sentence that gets straight to the point with no wasted words. It's appropriately sized and front-loaded, making it easy to parse quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of database operations, no annotations, no output schema, and incomplete parameter documentation, the description is inadequate. It should address behavioral traits (e.g., safety, output format) and parameter details to help the agent use it correctly in context with sibling tools.

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?

The description doesn't add any parameter-specific information beyond what the schema provides. With 0% schema description coverage and 1 parameter, the baseline is 4 for zero parameters, but here the parameter 'database' is undocumented in both schema and description. The description fails to explain what 'database' refers to (e.g., database name, connection string), so it doesn't compensate for the coverage gap.

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 'tables in a database', making the purpose immediately understandable. However, it doesn't differentiate from sibling tools like 'list_databases' or 'get_table_schema', which would require more specificity about scope or output format.

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 like 'list_databases' or 'get_table_schema'. The description only states what it does without indicating appropriate contexts or exclusions, 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