Skip to main content
Glama
gigapi

GigAPI MCP Server

by gigapi

list_databases

Retrieve a comprehensive list of all databases within your GigAPI cluster, enabling efficient management and querying of timeseries data.

Instructions

List all databases on your GigAPI cluster.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
input_dataYes

Implementation Reference

  • The primary handler function for the 'list_databases' MCP tool. It invokes the client's list_databases method, formats the response with success status and count, and handles errors.
    def list_databases(self, database: str = "mydb") -> Dict[str, Any]: """List all databases on GigAPI. Returns: List of databases """ try: databases = self.client.list_databases(database) return { "databases": databases, "success": True, "count": len(databases) } except GigAPIClientError as e: logger.error(f"Failed to list databases: {e}") return { "error": str(e), "success": False, "databases": [] }
  • Registration of the 'list_databases' tool using FastMCP's Tool.from_function, wrapping the handler in a lambda to handle input parameters.
    Tool.from_function( lambda input_data: tools_instance.list_databases(input_data.get("database", "mydb")), name="list_databases", description="List all databases on your GigAPI cluster.", ),
  • Helper method in the GigAPIClient that executes a 'SHOW DATABASES' SQL query to retrieve the list of databases, parsing the NDJSON response.
    def list_databases(self, database: str = "mydb") -> List[str]: """List all databases. Returns: List of database names """ query = "SHOW DATABASES" response = self.execute_query(query, database) logger.debug(f"Raw SHOW DATABASES response: {response}") if response.error: raise GigAPIClientError(f"Failed to list databases: {response.error}") # Extract database names from NDJSON results databases = [] for result in response.results: if "database_name" in result: databases.append(result["database_name"]) elif "name" in result: databases.append(result["name"]) elif "databases" in result: databases.extend(result["databases"]) return databases

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