Skip to content

KustoClient

Attributes

ClusterName module-attribute

ClusterName = str

DatabaseName module-attribute

DatabaseName = str

Query module-attribute

Query = str

ChartType module-attribute

ChartType = Literal['Html Table', 'Pie Chart', 'Time Chart', 'Bar Chart']

Classes

Table dataclass

Table(*, value: Optional[List[Row | Mapping[str, Any]]] = None)

Response for Run KQL query

VisualizeResults dataclass

VisualizeResults(*, body: Optional[str] = None, body_html: Optional[str] = None, attachment_content: Optional[str] = None, attachment_name: Optional[str] = None, kusto_deep_link: Optional[str] = None)

Response for Run KQL query and render a chart

Attributes

body class-attribute instance-attribute
body: Optional[str] = dataclass_field(default=None, kw_only=True)

The body of the result in base64 encoding.

body_html class-attribute instance-attribute
body_html: Optional[str] = dataclass_field(default=None, kw_only=True, metadata={'wire_name': 'bodyHtml'})

The body of the result in html encoding.

attachment_content class-attribute instance-attribute
attachment_content: Optional[str] = dataclass_field(default=None, kw_only=True, metadata={'wire_name': 'attachmentContent'})

The content of the attachment.

attachment_name class-attribute instance-attribute
attachment_name: Optional[str] = dataclass_field(default=None, kw_only=True, metadata={'wire_name': 'attachmentName'})

The name of the attachment file.

kusto_deep_link: Optional[str] = dataclass_field(default=None, kw_only=True, metadata={'wire_name': 'kustoDeepLink'})

Links to run the query in Kusto tools, for instance in KustoExplorer.

AsyncCommandResult dataclass

AsyncCommandResult(*, state: Optional[str] = None, status: Optional[str] = None, operation_id: Optional[str] = None)

Response for Run async control command

Attributes

state class-attribute instance-attribute
state: Optional[str] = dataclass_field(default=None, kw_only=True)

The state of the command.

status class-attribute instance-attribute
status: Optional[str] = dataclass_field(default=None, kw_only=True)

The status of the command.

operation_id class-attribute instance-attribute
operation_id: Optional[str] = dataclass_field(default=None, kw_only=True, metadata={'wire_name': 'operationId'})

The operation ID of the control command

MCPQueryResponse dataclass

MCPQueryResponse(*, jsonrpc: Optional[str] = None, id: Optional[str] = None, method: Optional[str] = None, params: Optional[Dict[str, Any]] = None, result: Optional[Dict[str, Any]] = None, error: Optional[Dict[str, Any]] = None)

Response for Kusto Query MCP Server

ObjectEntity dataclass

ObjectEntity(*, additional_properties: Dict[str, Any] = dict())

Response for Query schema

Attributes

additional_properties class-attribute instance-attribute
additional_properties: Dict[str, Any] = dataclass_field(default_factory=dict, kw_only=True)

Dynamic properties determined at runtime (similar to .NET [JsonExtensionData])

Row dataclass

Row(*, additional_properties: Dict[str, Any] = dict())

Definition: Row

Attributes

additional_properties class-attribute instance-attribute
additional_properties: Dict[str, Any] = dataclass_field(default_factory=dict, kw_only=True)

Dynamic properties determined at runtime (similar to .NET [JsonExtensionData])

QueryAndVisualizeSchema dataclass

QueryAndVisualizeSchema(cluster: ClusterName, db: DatabaseName, csl: Query, chart_type: ChartType)

Definition: QueryAndVisualizeSchema

CommandAndVisualizeSchema dataclass

CommandAndVisualizeSchema(cluster: ClusterName, db: DatabaseName, csl: str, chart_type: ChartType)

Definition: CommandAndVisualizeSchema

Attributes

csl instance-attribute
csl: str

Specify the control command you would like to run

QueryAndListSchema dataclass

QueryAndListSchema(cluster: ClusterName, db: DatabaseName, csl: Query)

Definition: QueryAndListSchema

ControlCommandAndListSchema dataclass

ControlCommandAndListSchema(cluster: ClusterName, db: DatabaseName, csl: str)

Definition: ControlCommandAndListSchema

Attributes

csl instance-attribute
csl: str

Specify the show control command you would like to run

MCPQueryRequest dataclass

MCPQueryRequest(*, jsonrpc: Optional[str] = None, id: Optional[str] = None, method: Optional[str] = None, params: Optional[Dict[str, Any]] = None, result: Optional[Dict[str, Any]] = None, error: Optional[Dict[str, Any]] = None, callback_endpoint: Optional[str] = None)

Definition: MCPQueryRequest

KustoClient

KustoClient(connection_runtime_url: str, credential: AsyncTokenCredential | AzureKeyCredential, *, max_retry_attempts: int = 3, timeout: float = 30.0, use_exponential_backoff: bool = True, initial_retry_delay_seconds: float = 0.5, maximum_retry_delay_seconds: float = 120.0, retry_jitter_factor: float = 0.1, retry_unsafe_http_methods: bool = False, transport: Optional[AsyncHttpTransport] = None, **kwargs: Any)

Bases: ConnectorClientBase

Typed client for kusto connector.

Initialize a KustoClient.

Parameters:

Name Type Description Default
connection_runtime_url str

The connection runtime URL from Azure Portal.

required
credential AsyncTokenCredential | AzureKeyCredential

Caller-owned Azure Core credential.

required
max_retry_attempts int

The maximum number of request attempts.

3
timeout float

The network timeout in seconds for each request. The value configures Azure Core retry and transport deadlines. Nonpositive values disable SDK and transport deadlines.

30.0
use_exponential_backoff bool

Whether retries use exponential backoff.

True
initial_retry_delay_seconds float

The initial retry delay in seconds.

0.5
maximum_retry_delay_seconds float

The maximum retry delay in seconds.

120.0
retry_jitter_factor float

The jitter fraction applied to retry delays.

0.1
retry_unsafe_http_methods bool

Whether unsafe HTTP methods may be retried.

False
transport Optional[AsyncHttpTransport]

Optional Azure Core async HTTP transport closed by the client through its asynchronous lifecycle.

None
**kwargs Any

Optional Azure Core pipeline policy settings.

{}

Methods:

begin_list_kusto_results async
begin_list_kusto_results(input: QueryAndListSchema | Mapping[str, Any], *, timeout: Optional[float] = None, headers: Optional[Mapping[str, str]] = None, client_request_id: Optional[str] = None, response_hook: Optional[ConnectorResponseHook] = None) -> AsyncLROPoller[dict[str, Any] | None]

Run KQL query

Runs the KQL query and returns the result as a set of rows which can be iterated over in the following connectors e.g TableName | take 10.

Returns an Azure Core async poller for the connector operation.

Swagger operation ID: listKustoResultsPost.

Parameters:

Name Type Description Default
input QueryAndListSchema | Mapping[str, Any]

The request body. Mapping keys use serialized Swagger wire names.

required
timeout Optional[float]

The request timeout in seconds.

None
headers Optional[Mapping[str, str]]

Additional HTTP request headers.

None
client_request_id Optional[str]

A caller-provided request identifier.

None
response_hook Optional[ConnectorResponseHook]

A callback invoked with the connector response.

None

Returns:

Type Description
AsyncLROPoller[dict[str, Any] | None]

AsyncLROPoller[dict[str, Any] | None]: An Azure Core poller for the connector operation.

Raises:

Type Description
ConnectorException

If the connector request fails.

begin_list_kusto_show_command_results async
begin_list_kusto_show_command_results(input: ControlCommandAndListSchema | Mapping[str, Any], *, timeout: Optional[float] = None, headers: Optional[Mapping[str, str]] = None, client_request_id: Optional[str] = None, response_hook: Optional[ConnectorResponseHook] = None) -> AsyncLROPoller[dict[str, Any] | None]

Run show control command

Runs the show control command and returns the result as a set of rows which can be iterated over in the following connectors e.g .show table TableName policy caching.

Returns an Azure Core async poller for the connector operation.

Swagger operation ID: listKustoShowCommandResultsPost.

Parameters:

Name Type Description Default
input ControlCommandAndListSchema | Mapping[str, Any]

The request body. Mapping keys use serialized Swagger wire names.

required
timeout Optional[float]

The request timeout in seconds.

None
headers Optional[Mapping[str, str]]

Additional HTTP request headers.

None
client_request_id Optional[str]

A caller-provided request identifier.

None
response_hook Optional[ConnectorResponseHook]

A callback invoked with the connector response.

None

Returns:

Type Description
AsyncLROPoller[dict[str, Any] | None]

AsyncLROPoller[dict[str, Any] | None]: An Azure Core poller for the connector operation.

Raises:

Type Description
ConnectorException

If the connector request fails.

begin_run_kusto_query_and_visualize_results async
begin_run_kusto_query_and_visualize_results(input: QueryAndVisualizeSchema | Mapping[str, Any], *, timeout: Optional[float] = None, headers: Optional[Mapping[str, str]] = None, client_request_id: Optional[str] = None, response_hook: Optional[ConnectorResponseHook] = None) -> AsyncLROPoller[dict[str, Any] | None]

Run KQL query and render a chart

Runs the KQL query and returns result as a chart of your choice e.g TableName | where Timestamp > ago(1h) | project timestamp, value.

Returns an Azure Core async poller for the connector operation.

Swagger operation ID: runKustoQueryAndVisualizeResultsPost.

Parameters:

Name Type Description Default
input QueryAndVisualizeSchema | Mapping[str, Any]

The request body. Mapping keys use serialized Swagger wire names.

required
timeout Optional[float]

The request timeout in seconds.

None
headers Optional[Mapping[str, str]]

Additional HTTP request headers.

None
client_request_id Optional[str]

A caller-provided request identifier.

None
response_hook Optional[ConnectorResponseHook]

A callback invoked with the connector response.

None

Returns:

Type Description
AsyncLROPoller[dict[str, Any] | None]

AsyncLROPoller[dict[str, Any] | None]: An Azure Core poller for the connector operation.

Raises:

Type Description
ConnectorException

If the connector request fails.

begin_run_kusto_command_and_visualize_results async
begin_run_kusto_command_and_visualize_results(input: CommandAndVisualizeSchema | Mapping[str, Any], *, timeout: Optional[float] = None, headers: Optional[Mapping[str, str]] = None, client_request_id: Optional[str] = None, response_hook: Optional[ConnectorResponseHook] = None) -> AsyncLROPoller[dict[str, Any] | None]

Run control command and render a chart

Runs the control command and returns the result as a chart of your choice e.g .clear table TableName data.

Returns an Azure Core async poller for the connector operation.

Swagger operation ID: runKustoCommandAndVisualizeResultsPost.

Parameters:

Name Type Description Default
input CommandAndVisualizeSchema | Mapping[str, Any]

The request body. Mapping keys use serialized Swagger wire names.

required
timeout Optional[float]

The request timeout in seconds.

None
headers Optional[Mapping[str, str]]

Additional HTTP request headers.

None
client_request_id Optional[str]

A caller-provided request identifier.

None
response_hook Optional[ConnectorResponseHook]

A callback invoked with the connector response.

None

Returns:

Type Description
AsyncLROPoller[dict[str, Any] | None]

AsyncLROPoller[dict[str, Any] | None]: An Azure Core poller for the connector operation.

Raises:

Type Description
ConnectorException

If the connector request fails.

begin_run_async_control_command_and_wait async
begin_run_async_control_command_and_wait(input: ControlCommandAndListSchema | Mapping[str, Any], *, timeout: Optional[float] = None, headers: Optional[Mapping[str, str]] = None, client_request_id: Optional[str] = None, response_hook: Optional[ConnectorResponseHook] = None) -> AsyncLROPoller[dict[str, Any] | None]

Run async control command

Runs control command in async mode and returns its ID, state and status on completion. Command can run for maximum 1 hour. The 'async' keyword is mandatory e.g .set-or-append async TargetTable <| SourceTable.

Returns an Azure Core async poller for the connector operation.

Swagger operation ID: runAsyncControlCommandAndWait.

Parameters:

Name Type Description Default
input ControlCommandAndListSchema | Mapping[str, Any]

The request body. Mapping keys use serialized Swagger wire names.

required
timeout Optional[float]

The request timeout in seconds.

None
headers Optional[Mapping[str, str]]

Additional HTTP request headers.

None
client_request_id Optional[str]

A caller-provided request identifier.

None
response_hook Optional[ConnectorResponseHook]

A callback invoked with the connector response.

None

Returns:

Type Description
AsyncLROPoller[dict[str, Any] | None]

AsyncLROPoller[dict[str, Any] | None]: An Azure Core poller for the connector operation.

Raises:

Type Description
ConnectorException

If the connector request fails.

mcp_kusto_query_management async
mcp_kusto_query_management(input: MCPQueryRequest | Mapping[str, Any], *, session_id: Optional[str] = None, timeout: Optional[float] = None, headers: Optional[Mapping[str, str]] = None, client_request_id: Optional[str] = None, response_hook: Optional[ConnectorResponseHook] = None) -> dict[str, Any] | None

Kusto Query MCP Server

This MCP server runs Kusto queries and manages the results.

Swagger operation ID: mcp_KustoQueryManagement.

Parameters:

Name Type Description Default
input MCPQueryRequest | Mapping[str, Any]

The request body. Mapping keys use serialized Swagger wire names.

required
session_id Optional[str]

sessionId.

None
timeout Optional[float]

The request timeout in seconds.

None
headers Optional[Mapping[str, str]]

Additional HTTP request headers.

None
client_request_id Optional[str]

A caller-provided request identifier.

None
response_hook Optional[ConnectorResponseHook]

A callback invoked with the connector response.

None

Returns:

Type Description
dict[str, Any] | None

dict[str, Any] | None: The connector operation result.

Raises:

Type Description
ConnectorException

If the connector request fails.

list_kusto_results_schema async
list_kusto_results_schema(input: QueryAndListSchema | Mapping[str, Any], *, timeout: Optional[float] = None, headers: Optional[Mapping[str, str]] = None, client_request_id: Optional[str] = None, response_hook: Optional[ConnectorResponseHook] = None) -> dict[str, Any] | None

Query schema

Gets the schema for a query

Swagger operation ID: listKustoResultsSchemaPost.

Parameters:

Name Type Description Default
input QueryAndListSchema | Mapping[str, Any]

The request body. Mapping keys use serialized Swagger wire names.

required
timeout Optional[float]

The request timeout in seconds.

None
headers Optional[Mapping[str, str]]

Additional HTTP request headers.

None
client_request_id Optional[str]

A caller-provided request identifier.

None
response_hook Optional[ConnectorResponseHook]

A callback invoked with the connector response.

None

Returns:

Type Description
dict[str, Any] | None

dict[str, Any] | None: The connector operation result.

Raises:

Type Description
ConnectorException

If the connector request fails.