Skip to main content
Glama
gigapi

GigAPI MCP Server

by gigapi

list_tables

Retrieve a list of all tables within a specified database using the MCP server for efficient data management and querying in GigAPI Timeseries Lake.

Instructions

List all tables in a database.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
databaseYes

Implementation Reference

  • The main handler function for the 'list_tables' tool. It invokes the client's list_tables method, formats the response with success status, table list, count, and handles errors appropriately.
    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": [] }
  • Registers the list_tables handler as an MCP tool using FastMCP's Tool.from_function, specifying the name and description.
    Tool.from_function( tools_instance.list_tables, name="list_tables", description="List all tables in a database.", ),
  • Supporting client method that performs a 'SHOW TABLES' query on the GigAPI server to retrieve and parse the list of tables.
    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

Other Tools

Related 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