td_list_databases
Retrieve a list of accessible databases to discover available data sources and verify permissions. Use verbose mode for detailed information or pagination for large datasets.
Instructions
List available databases to find data sources and check access.
Shows all databases you can access. Returns just names for quick overview,
or set verbose=True for details like table count and permissions.
Common scenarios:
- Discover what databases are available in your account
- Check permissions on specific databases
- Get database list for documentation or auditing
Use pagination (limit/offset) for large lists or all_results=True for everything.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| all_results | No | ||
| limit | No | ||
| offset | No | ||
| verbose | No |
Implementation Reference
- td_mcp_server/mcp_impl.py:150-190 (handler)The primary handler function for the 'td_list_databases' MCP tool. Decorated with @mcp.tool() for automatic registration. Lists Treasure Data databases using the API client, supporting verbose output, pagination (limit/offset), and all_results flag. Handles errors gracefully.@mcp.tool() async def td_list_databases( verbose: bool = False, limit: int = DEFAULT_LIMIT, offset: int = 0, all_results: bool = False, ) -> dict[str, Any]: """List available databases to find data sources and check access. Shows all databases you can access. Returns just names for quick overview, or set verbose=True for details like table count and permissions. Common scenarios: - Discover what databases are available in your account - Check permissions on specific databases - Get database list for documentation or auditing Use pagination (limit/offset) for large lists or all_results=True for everything. """ client = _create_client() if isinstance(client, dict): return client try: databases = client.get_databases( limit=limit, offset=offset, all_results=all_results ) if verbose: # Return full database details return {"databases": [db.model_dump() for db in databases]} else: # Return only database names return {"databases": [db.name for db in databases]} except (ValueError, requests.RequestException) as e: return _format_error_response(f"Failed to retrieve databases: {str(e)}") except Exception as e: return _format_error_response( f"Unexpected error while retrieving databases: {str(e)}" )
- td_mcp_server/mcp_impl.py:150-150 (registration)The @mcp.tool() decorator registers the td_list_databases function as an MCP tool with the FastMCP server instance 'mcp'.@mcp.tool()
- td_mcp_server/mcp_impl.py:151-156 (schema)Function signature defines the input schema (parameters with types and defaults) and output type for the tool.async def td_list_databases( verbose: bool = False, limit: int = DEFAULT_LIMIT, offset: int = 0, all_results: bool = False, ) -> dict[str, Any]: