Skip to content

Add show_stats parameter to kusto_query and kusto_graph_query #122

Description

@gholliday

Summary

When running KQL queries for optimization purposes, it's useful to have access to execution statistics (CPU, memory, cache, network, extents scanned, etc.) returned by the Kusto SDK alongside query results.

Proposed Change

Add an opt-in show_stats: bool = False parameter to kusto_query and kusto_graph_query. When True, extract statistics from the QueryCompletionInformation tables in the SDK response and include them as a top-level statistics key in the tool response.

Statistics included

  • Execution time (server + total)
  • CPU usage
  • Peak memory
  • Cache hits/misses (hot/cold)
  • Network bytes
  • Extents scanned / deleted / orphaned, rows scanned
  • Result size
  • Per-cluster cross-cluster breakdown
Image

Motivation

Enables query optimization agents to understand query cost without needing a separate profiling step.

Related prior art: microsoft/mcp#1787

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions