td_get_database
Retrieve detailed information about a specific Treasure Data database, including table count, permissions, metadata, and protection status for verification and auditing purposes.
Instructions
Get specific database details like table count, permissions, and metadata.
Shows detailed information about a named database. Use when you need to check
database properties, understand access permissions, or get table statistics.
Common scenarios:
- Verify database exists before running queries
- Check permission level (administrator, read-only, etc.)
- Get table count and creation/update timestamps
- Audit database properties for documentation
Returns creation time, table count, permissions, and protection status.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| database_name | Yes |
Implementation Reference
- td_mcp_server/mcp_impl.py:192-229 (handler)The core handler function for the 'td_get_database' tool. It is registered via the @mcp.tool() decorator, performs input validation, creates a TreasureDataClient instance, calls client.get_database() to fetch details, and returns the database information as a dictionary or an appropriate error message.@mcp.tool() async def td_get_database(database_name: str) -> dict[str, Any]: """Get specific database details like table count, permissions, and metadata. Shows detailed information about a named database. Use when you need to check database properties, understand access permissions, or get table statistics. Common scenarios: - Verify database exists before running queries - Check permission level (administrator, read-only, etc.) - Get table count and creation/update timestamps - Audit database properties for documentation Returns creation time, table count, permissions, and protection status. """ # Input validation if not database_name or not database_name.strip(): return _format_error_response("Database name cannot be empty") client = _create_client() if isinstance(client, dict): return client try: database = client.get_database(database_name) if database: return {"database": database.model_dump()} else: return _format_error_response(f"Database '{database_name}' not found") except (ValueError, requests.RequestException) as e: return _format_error_response( f"Failed to retrieve database '{database_name}': {str(e)}" ) except Exception as e: return _format_error_response( f"Unexpected error while retrieving database '{database_name}': {str(e)}" )