list_databases
Retrieve a comprehensive list of all accessible databases within the DataPilot MCP Server environment to manage and interact with Snowflake data resources effectively.
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)MCP tool handler for 'list_databases' decorated with @mcp.tool(), which registers the tool and executes the logic by delegating to SnowflakeClient.list_databases()@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/snowflake_client.py:125-129 (helper)Core helper method in SnowflakeClient that implements the database listing logic by executing 'SHOW DATABASES' query and extracting names from resultsasync 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]