list_databases
Retrieve all available databases for user access to enable data exploration and management operations.
Instructions
List all databases available to the user
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "list_databases"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
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]