Skip to main content
Glama
pab1it0

adx-mcp-server

list_tables

Retrieve a list of all tables in your Azure Data Explorer database, including table names, folders, and database associations.

Instructions

Retrieves a list of all tables available in the configured Azure Data Explorer database, including their names, folders, and database associations.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The 'list_tables' tool handler function. It is decorated with @mcp.tool, connects to ADX, runs '.show tables | project TableName, Folder, DatabaseName', formats and returns results.
    @mcp.tool(description="Retrieves a list of all tables available in the configured Azure Data Explorer database, including their names, folders, and database associations.")
    async def list_tables() -> List[Dict[str, Any]]:
        """List all tables in the configured ADX database."""
        logger.info("Listing tables", database=config.database)
    
        if not config.cluster_url or not config.database:
            logger.error("Missing ADX configuration")
            raise ValueError("Azure Data Explorer configuration is missing. Please set ADX_CLUSTER_URL and ADX_DATABASE environment variables.")
    
        try:
            client = get_kusto_client()
            query = ".show tables | project TableName, Folder, DatabaseName"
            result_set = client.execute(config.database, query)
            results = format_query_results(result_set)
            logger.info("Tables listed successfully", table_count=len(results))
            return results
        except Exception as e:
            logger.error("Failed to list tables", error=str(e), exception_type=type(e).__name__)
            raise
  • The tool registration using the @mcp.tool decorator from FastMCP, which registers 'list_tables' as an MCP tool with FastMCP.
    @mcp.tool(description="Retrieves a list of all tables available in the configured Azure Data Explorer database, including their names, folders, and database associations.")
  • The get_kusto_client() helper used by list_tables to create a KustoClient with Azure credentials.
    def get_kusto_client() -> KustoClient:
        """
        Create and configure a Kusto client with appropriate Azure credentials.
    
        Prioritizes WorkloadIdentityCredential when running in AKS with workload identity,
        falls back to DefaultAzureCredential for other authentication methods.
    
        Returns:
            KustoClient: Configured Kusto client instance
        """
        tenant_id = os.environ.get('AZURE_TENANT_ID')
        client_id = os.environ.get('AZURE_CLIENT_ID')
        token_file_path = os.environ.get('ADX_TOKEN_FILE_PATH', '/var/run/secrets/azure/tokens/azure-identity-token')
    
        if tenant_id and client_id:
            logger.info(
                "Using WorkloadIdentityCredential",
                client_id=client_id,
                tenant_id=tenant_id,
                token_file_path=token_file_path
            )
            try:
                credential = WorkloadIdentityCredential(
                    tenant_id=tenant_id,
                    client_id=client_id,
                    token_file_path=token_file_path
                )
            except Exception as e:
                logger.warning(
                    "Failed to initialize WorkloadIdentityCredential, falling back",
                    error=str(e),
                    exception_type=type(e).__name__
                )
                credential = DefaultAzureCredential()
        else:
            logger.info("Using DefaultAzureCredential (missing WorkloadIdentity credentials)")
            credential = DefaultAzureCredential()
    
        try:
            kcsb = KustoConnectionStringBuilder.with_azure_token_credential(
                connection_string=config.cluster_url,
                credential=credential
            )
            client = KustoClient(kcsb)
            logger.debug("Kusto client initialized successfully", cluster_url=config.cluster_url)
            return client
        except Exception as e:
            logger.error(
                "Failed to create Kusto client",
                error=str(e),
                exception_type=type(e).__name__,
                cluster_url=config.cluster_url
            )
            raise
  • The format_query_results() helper used by list_tables to format Kusto query results into dictionaries.
    def format_query_results(result_set) -> List[Dict[str, Any]]:
        """
        Format Kusto query results into a list of dictionaries.
    
        Args:
            result_set: Raw result set from KustoClient
    
        Returns:
            List of dictionaries with column names as keys
        """
        if not result_set or not result_set.primary_results:
            logger.debug("Empty or null result set received")
            return []
    
        try:
            primary_result = result_set.primary_results[0]
            columns = [col.column_name for col in primary_result.columns]
    
            formatted_results = []
            for row in primary_result.rows:
                record = {}
                for i, value in enumerate(row):
                    record[columns[i]] = value
                formatted_results.append(record)
    
            logger.debug("Query results formatted", row_count=len(formatted_results), columns=columns)
            return formatted_results
        except Exception as e:
            logger.error(
                "Error formatting query results",
                error=str(e),
                exception_type=type(e).__name__
            )
            raise
Behavior3/5

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

No annotations are provided, so the description carries full burden. It indicates a read operation (retrieves) without mentioning side effects, auth needs, or rate limits. For a simple list operation, this is minimally adequate but lacks explicit disclosure of read-only behavior.

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?

Single sentence, front-loaded with verb 'Retrieves'. Every word adds value with no 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?

Complexity is low (empty schema, 0 parameters). Description covers what the tool returns (table names, folders, database associations). Presence of an output schema reduces burden, and the description aligns well.

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

Parameters3/5

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

Input schema has no parameters (100% coverage), so baseline is 3. The description adds no parameter details, which is acceptable since there are none.

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?

Description clearly states the tool retrieves a list of all tables in the Azure Data Explorer database, specifying the returned fields (names, folders, database associations). This distinguishes it from sibling tools like get_table_details or get_table_schema which focus on individual tables or schemas.

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

Usage Guidelines2/5

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

No guidance on when to use this tool versus alternatives. The description does not mention when to use list_tables instead of execute_query, get_table_details, etc. Context about use cases or exclusions is absent.

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/pab1it0/adx-mcp-server'

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