Skip to main content
Glama
knishioka

Treasure Data MCP Server

by knishioka

td_get_database

Retrieve database details including table count, permissions, and metadata from Treasure Data to verify properties, check access levels, and audit database information.

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
NameRequiredDescriptionDefault
database_nameYes

Implementation Reference

  • The primary handler function for the 'td_get_database' tool. It is decorated with @mcp.tool(), which registers it with the FastMCP server. The function validates the database_name input, creates a TreasureDataClient instance, retrieves the database details using client.get_database(), and returns the database information as a dictionary or an 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)}" )
  • The function signature defines the input schema (database_name: str) and output type (dict[str, Any]), which serves as the tool's parameter schema in FastMCP.
    async def td_get_database(database_name: str) -> dict[str, Any]:
  • The @mcp.tool() decorator registers the td_get_database function as an MCP tool with the FastMCP server instance 'mcp'.
    @mcp.tool()

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/knishioka/td-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server