Skip to main content
Glama
pab1it0

adx-mcp-server

sample_table_data

Retrieve a random sample of rows from Azure Data Explorer tables to preview data structure and content before analysis.

Instructions

Retrieves a random sample of rows from the specified table in the Azure Data Explorer database. The sample_size parameter controls how many rows to return (default: 10).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
table_nameYes
sample_sizeNo

Implementation Reference

  • The handler function for the 'sample_table_data' tool, which is automatically registered via the @mcp.tool decorator. It samples rows from a specified ADX table using a KQL query and formats the results into a list of dictionaries.
    @mcp.tool(description="Retrieves a random sample of rows from the specified table in the Azure Data Explorer database. The sample_size parameter controls how many rows to return (default: 10).")
    async def sample_table_data(table_name: str, sample_size: int = 10) -> List[Dict[str, Any]]:
        """Get sample data from a table."""
        logger.info("Sampling table data", table_name=table_name, sample_size=sample_size, 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 = f"{table_name} | sample {sample_size}"
            result_set = client.execute(config.database, query)
            results = format_query_results(result_set)
            logger.info("Sample data retrieved successfully", table_name=table_name, row_count=len(results))
            return results
        except Exception as e:
            logger.error("Failed to sample table data", table_name=table_name, error=str(e), exception_type=type(e).__name__)
            raise

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