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
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/m4/core/tools/tabular.py:64-84 (handler)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}")
- src/m4/core/tools/tabular.py:25-29 (schema)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
- src/m4/core/tools/__init__.py:64-64 (registration)Registration of GetDatabaseSchemaTool instance in the core ToolRegistry during init_tools().ToolRegistry.register(GetDatabaseSchemaTool())
- src/m4/mcp_server.py:105-124 (registration)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
- src/m4/mcp_server.py:32-32 (schema)Import of GetDatabaseSchemaInput schema used in the MCP adapter.GetDatabaseSchemaInput,