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()
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It describes what information is returned (creation time, table count, permissions, protection status) and implies a read-only operation ('Get', 'Shows'), but doesn't specify error handling, rate limits, or authentication requirements. It adds some behavioral context but lacks details on potential failures or constraints.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured with a clear opening sentence, usage guidance, and bullet-pointed scenarios. It's appropriately sized for the tool's complexity, though the bullet points could be slightly condensed. Every sentence adds value without redundancy.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's moderate complexity (1 parameter, no output schema, no annotations), the description is fairly complete. It covers purpose, usage, scenarios, and return values. However, it lacks explicit error handling or performance details, which would be helpful for a tool that queries database metadata.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 1 parameter with 0% description coverage, and the description doesn't explicitly mention the 'database_name' parameter. However, it implies the parameter through context ('named database', 'specific database'), and with only 1 parameter, the baseline is high. The description adds meaning by clarifying what the parameter represents (a specific database to query), compensating somewhat for the schema gap.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose with specific verbs ('Get', 'Shows') and resources ('database details', 'information about a named database'). It distinguishes from sibling tools like 'td_list_databases' (which likely lists databases) by focusing on retrieving detailed information for a specific database.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description explicitly states when to use the tool ('Use when you need to check database properties, understand access permissions, or get table statistics') and provides common scenarios (e.g., verifying existence, checking permissions, auditing). It distinguishes from alternatives by focusing on detailed metadata rather than listing or analyzing.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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