Skip to main content
Glama

list_schemas

Retrieve all database schemas to explore available data structures and organize information for analysis.

Instructions

List all schemas in a database

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
databaseYes

Implementation Reference

  • The MCP tool handler function for 'list_schemas'. It retrieves schemas for a given database using the SnowflakeClient and provides user feedback via context.
    @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 []
  • Helper method in SnowflakeClient that executes the SHOW SCHEMAS SQL query and extracts schema names.
    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()
  • MCP resource that also uses list_schemas functionality for snowflake://schemas/{database}.
    @mcp.resource("snowflake://schemas/{database}") async def get_schemas_resource(database: str) -> List[str]: """Resource to get list of schemas in a database""" try: client = await get_snowflake_client() return await client.list_schemas(database) except Exception as e: logger.error(f"Error getting schemas resource: {str(e)}") return []

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