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)}" )

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