list_databases
Retrieve all available databases for user access to enable data exploration and management operations.
Instructions
List all databases available to the user
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/main.py:105-120 (handler)The main handler function for the 'list_databases' MCP tool. It retrieves the list of available Snowflake databases using the SnowflakeClient and returns them as a list of strings.@mcp.tool() async def list_databases(ctx: Context) -> List[str]: """List all databases available to the user""" await ctx.info("Retrieving list of databases...") try: client = await get_snowflake_client() databases = await client.list_databases() await ctx.info(f"Found {len(databases)} databases") return databases except Exception as e: logger.error(f"Error listing databases: {str(e)}") await ctx.error(f"Failed to list databases: {str(e)}") return []
- src/main.py:105-105 (registration)The @mcp.tool() decorator registers the list_databases function as an MCP tool.@mcp.tool()
- src/snowflake_client.py:125-128 (helper)Helper method in SnowflakeClient class that executes the 'SHOW DATABASES' SQL command to list databases the user has access to.async def list_databases(self) -> List[str]: """List all databases user has access to""" result = await self.execute_query("SHOW DATABASES") return [row.get('name', '') for row in result.data if result.success]