Skip to main content
Glama

list_schemas

Retrieve all available schemas within a specified database, enabling users to manage and analyze database structures effectively through DataPilot MCP Server.

Instructions

List all schemas in a database

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
databaseYes

Implementation Reference

  • The MCP tool handler for 'list_schemas'. Decorated with @mcp.tool(), it handles the tool execution by acquiring a Snowflake client and delegating to its list_schemas method, with context logging and error handling.
    @mcp.tool() async def list_schemas(database: str, ctx: Context) -> List[str]: """List all schemas in a database""" await ctx.info(f"Retrieving schemas for database: {database}") try: client = await get_snowflake_client() schemas = await client.list_schemas(database) await ctx.info(f"Found {len(schemas)} schemas in {database}") return schemas except Exception as e: logger.error(f"Error listing schemas: {str(e)}") await ctx.error(f"Failed to list schemas: {str(e)}") return []
  • Core helper method in the SnowflakeClient class that executes the 'SHOW SCHEMAS IN DATABASE' SQL query and extracts schema names from the result.
    async def list_schemas(self, database: str) -> List[str]: """List all schemas in a database""" result = await self.execute_query(f"SHOW SCHEMAS IN DATABASE {database}") return [row.get('name', '') for row in result.data if result.success]
  • src/main.py:122-122 (registration)
    The @mcp.tool() decorator registers the list_schemas function as an MCP tool.
    @mcp.tool()
  • Type hints define the input schema (database: str, ctx: Context) and output schema (List[str]) for the tool.
    async def list_schemas(database: str, ctx: Context) -> List[str]:

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/rickyb30/datapilot-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server