list_databases
Retrieve a list of all available ClickHouse databases on the mcp-clickhouse-long-running server for database querying and management.
Instructions
List available ClickHouse databases
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "list_databases"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- mcp_clickhouse/mcp_server.py:90-98 (handler)The handler function for the 'list_databases' tool. It is decorated with @mcp.tool() which registers the tool with the MCP server. The function connects to the ClickHouse client and executes the SHOW DATABASES command to list all available databases.
@mcp.tool() def list_databases(): """List available ClickHouse databases""" logger.info("Listing all databases") client = create_clickhouse_client() result = client.command("SHOW DATABASES") logger.info(f"Found {len(result) if isinstance(result, list) else 1} databases") return result - mcp_clickhouse/mcp_server.py:90-98 (registration)The @mcp.tool() decorator registers the list_databases function as an MCP tool.
@mcp.tool() def list_databases(): """List available ClickHouse databases""" logger.info("Listing all databases") client = create_clickhouse_client() result = client.command("SHOW DATABASES") logger.info(f"Found {len(result) if isinstance(result, list) else 1} databases") return result - mcp_clickhouse/__init__.py:1-6 (registration)Exports the list_databases function from mcp_server.py for use in other modules, such as tests.
from .mcp_server import ( create_clickhouse_client, list_databases, list_tables, run_select_query, )