Skip to main content
Glama
knishioka

Treasure Data MCP Server

by knishioka

td_list_tables

List tables in a Treasure Data database to explore data structure, find datasets, and check schemas, sizes, or record counts.

Instructions

List tables in a database to explore data structure and find datasets.

Shows all tables within a specific database. Returns table names for quick
scanning, or set verbose=True for schemas, sizes, and record counts.

Common scenarios:
- Explore available data in a database
- Find specific tables by scanning names
- Check table schemas before writing queries
- Audit table sizes and record counts
- Verify table exists before querying

Supports pagination (limit/offset) or all_results=True for complete list.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
database_nameYes
verboseNo
limitNo
offsetNo
all_resultsNo

Implementation Reference

  • The td_list_tables tool handler: an async function decorated with @mcp.tool() that validates input, creates a TreasureDataClient, verifies the database exists, fetches tables with pagination options, and returns table names or full details based on verbose flag.
    async def td_list_tables(
        database_name: str,
        verbose: bool = False,
        limit: int = DEFAULT_LIMIT,
        offset: int = 0,
        all_results: bool = False,
    ) -> dict[str, Any]:
        """List tables in a database to explore data structure and find datasets.
    
        Shows all tables within a specific database. Returns table names for quick
        scanning, or set verbose=True for schemas, sizes, and record counts.
    
        Common scenarios:
        - Explore available data in a database
        - Find specific tables by scanning names
        - Check table schemas before writing queries
        - Audit table sizes and record counts
        - Verify table exists before querying
    
        Supports pagination (limit/offset) or all_results=True for complete list.
        """
        # 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:
            # First, verify that the database exists
            database = client.get_database(database_name)
            if not database:
                return _format_error_response(f"Database '{database_name}' not found")
    
            # Get tables for the database
            tables = client.get_tables(
                database_name, limit=limit, offset=offset, all_results=all_results
            )
    
            if verbose:
                # Return full table details
                return {
                    "database": database_name,
                    "tables": [table.model_dump() for table in tables],
                }
            else:
                # Return only table names
                return {
                    "database": database_name,
                    "tables": [table.name for table in tables],
                }
        except (ValueError, requests.RequestException) as e:
            return _format_error_response(
                f"Failed to retrieve tables from database '{database_name}': {str(e)}"
            )
        except Exception as e:
            return _format_error_response(
                f"Unexpected error while retrieving tables from database "
                f"'{database_name}': {str(e)}"
            )
Behavior4/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It effectively describes key behaviors: the tool returns table names (or schemas/sizes/counts with verbose=True), supports pagination via limit/offset, and offers an all_results option. However, it doesn't mention potential rate limits, authentication requirements, or error conditions.

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

Conciseness5/5

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

The description is well-structured and front-loaded with the core purpose, followed by specific details and usage scenarios. Every sentence adds value: the first establishes purpose, the second explains output options, the scenarios provide concrete guidance, and the final sentence covers pagination behavior. No wasted words.

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?

For a tool with 5 parameters, 0% schema coverage, and no output schema, the description does an excellent job covering purpose, usage, and key behaviors. It explains what information is returned and how to control output. The main gap is lack of information about return format/structure since there's no output schema, but otherwise it's quite complete.

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?

With 0% schema description coverage, the description must compensate for the lack of parameter documentation in the schema. It explains the purpose of 'verbose' (shows schemas, sizes, record counts) and mentions 'limit/offset' and 'all_results' for pagination control. However, it doesn't explain 'database_name' parameter semantics or provide format/validation details.

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 specific action ('List tables in a database') and resource ('tables'), distinguishing it from sibling tools like td_list_databases or td_list_projects. It explicitly mentions exploring data structure and finding datasets, which provides concrete purpose beyond just the tool name.

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 provides explicit guidance through 'Common scenarios' that detail when to use this tool (e.g., explore available data, find specific tables, check schemas before queries). It also distinguishes usage by mentioning verbose mode for different information needs, though it doesn't explicitly name alternatives among siblings.

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