Skip to main content
Glama

get_database_schema

Discover available database tables to understand data structure before querying clinical datasets like MIMIC-IV and eICU.

Instructions

๐Ÿ“š Discover what data is available in the database.

When to use: Start here to understand what tables exist.

Returns: List of all available tables in the database with current backend info.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Invoke method of GetDatabaseSchemaTool that executes the core logic: retrieves backend info and lists available tables.
    def invoke(
        self, dataset: DatasetDefinition, params: GetDatabaseSchemaInput
    ) -> ToolOutput:
        """List available tables using the backend."""
        backend = get_backend()
        backend_info = backend.get_backend_info(dataset)
    
        try:
            tables = backend.get_table_list(dataset)
            if not tables:
                return ToolOutput(
                    result=f"{backend_info}\n**Available Tables:**\nNo tables found"
                )
    
            table_list = "\n".join(f"  {t}" for t in tables)
            return ToolOutput(
                result=f"{backend_info}\n**Available Tables:**\n{table_list}"
            )
        except Exception as e:
            return ToolOutput(result=f"{backend_info}\nError: {e}")
  • Input schema (dataclass) for the get_database_schema tool, which requires no parameters.
    @dataclass
    class GetDatabaseSchemaInput(ToolInput):
        """Input for get_database_schema tool."""
    
        pass  # No parameters needed
  • Registration of GetDatabaseSchemaTool instance in the core ToolRegistry during init_tools().
    ToolRegistry.register(GetDatabaseSchemaTool())
  • MCP tool registration/adapter: @mcp.tool() def get_database_schema() that delegates to core ToolRegistry.get('get_database_schema').invoke()
    @mcp.tool()
    @require_oauth2
    def get_database_schema() -> str:
        """๐Ÿ“š Discover what data is available in the database.
    
        **When to use:** Start here to understand what tables exist.
    
        Returns:
            List of all available tables in the database with current backend info.
        """
        dataset = DatasetRegistry.get_active()
    
        # Proactive capability check
        result = _tool_selector.check_compatibility("get_database_schema", dataset)
        if not result.compatible:
            return result.error_message
    
        tool = ToolRegistry.get("get_database_schema")
        return tool.invoke(dataset, GetDatabaseSchemaInput()).result
  • Import of GetDatabaseSchemaInput schema used in the MCP adapter.
    GetDatabaseSchemaInput,

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/hannesill/m4'

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