list_warehouses
Retrieve a list of all warehouses accessible to the user within the DataPilot MCP Server, enabling efficient management and allocation of Snowflake database resources.
Instructions
List all warehouses available to the user
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/main.py:237-252 (handler)The main MCP tool handler function for 'list_warehouses'. It uses the SnowflakeClient to fetch the list of available warehouses and provides user feedback via the context.@mcp.tool() async def list_warehouses(ctx: Context) -> List[Dict[str, Any]]: """List all warehouses available to the user""" await ctx.info("Retrieving list of warehouses...") try: client = await get_snowflake_client() warehouses = await client.list_warehouses() await ctx.info(f"Found {len(warehouses)} warehouses") return warehouses except Exception as e: logger.error(f"Error listing warehouses: {str(e)}") await ctx.error(f"Failed to list warehouses: {str(e)}") return []
- src/main.py:237-237 (registration)The @mcp.tool() decorator registers the list_warehouses function as an MCP tool.@mcp.tool()
- src/snowflake_client.py:188-192 (helper)Helper method in SnowflakeClient that executes 'SHOW WAREHOUSES' SQL command to retrieve warehouse list.async def list_warehouses(self) -> List[Dict[str, Any]]: """List all warehouses user has access to""" result = await self.execute_query("SHOW WAREHOUSES") return result.data if result.success else []