base_databaseList
Retrieve a complete list of all databases within the Teradata System for streamlined database management and analysis using the Teradata MCP Server.
Instructions
Lists all databases in the Teradata System.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- The handler function that lists databases by executing a fixed SQL query against dbc.DatabasesV, formatting the results into JSON with metadata.def handle_base_databaseList(conn: TeradataConnection, *args, **kwargs): """ Lists all databases in the Teradata System. Returns: ResponseType: formatted response with query results + metadata """ logger.debug(f"Tool: handle_base_databaseList: Args: None") sql = "select DataBaseName, DECODE(DBKind, 'U', 'User', 'D','DataBase') as DBType, CommentString from dbc.DatabasesV dv where OwnerName <> 'PDCRADM'" with conn.cursor() as cur: rows = cur.execute(sql) data = rows_to_json(cur.description, rows.fetchall()) metadata = { "tool_name": "base_databaseList", "sql": sql, "columns": [ {"name": col[0], "type": col[1].__name__ if hasattr(col[1], '__name__') else str(col[1])} for col in cur.description ] if cur.description else [], "row_count": len(data) } logger.debug(f"Tool: handle_base_databaseList: metadata: {metadata}") return create_response(data, metadata)
- src/teradata_mcp_server/app.py:343-364 (registration)The dynamic registration code in the MCP app factory that discovers handle_* functions via module loader, derives tool_name='base_databaseList' from 'handle_base_databaseList', wraps it for MCP compatibility (including schema from function signature), and registers it on the FastMCP server.# Register code tools via module loader module_loader = td.initialize_module_loader(config) if module_loader: all_functions = module_loader.get_all_functions() for name, func in all_functions.items(): if not (inspect.isfunction(func) and name.startswith("handle_")): continue tool_name = name[len("handle_"):] if not any(re.match(p, tool_name) for p in config.get('tool', [])): continue # Skip template tools (used for developer reference only) if tool_name.startswith("tmpl_"): logger.debug(f"Skipping template tool: {tool_name}") continue # Skip BAR tools if BAR functionality is disabled if tool_name.startswith("bar_") and not enableBAR: logger.info(f"Skipping BAR tool: {tool_name} (BAR functionality disabled)") continue wrapped = make_tool_wrapper(func) mcp.tool(name=tool_name, description=wrapped.__doc__)(wrapped) logger.info(f"Created tool: {tool_name}") logger.debug(f"Tool Docstring: {wrapped.__doc__}")