Skip to content
This repository was archived by the owner on Sep 4, 2025. It is now read-only.

Conversation

@amih90
Copy link
Contributor

@amih90 amih90 commented Apr 20, 2025

Overview

Introduces Azure Data Explorer (Kusto) operations, including:

  • Cluster management: List and Get for Kusto clusters.
  • Database management: List databases, List and Schema tables within a cluster.
  • Query execution: Run KQL Query, Sample against databases and retrieve results.

Usage

# List Kusto clusters in a subscription
azmcp kusto cluster list --subscription <subscription>

# Get details for a Kusto cluster
azmcp kusto cluster get --subscription <subscription> --cluster-name <cluster-name>

# List databases in a Kusto cluster
azmcp kusto database list [--cluster-uri <cluster-uri> | --subscription <subscription> --cluster-name <cluster-name>]

# List tables in a Kusto database
azmcp kusto table list [--cluster-uri <cluster-uri> | --subscription <subscription> --cluster-name <cluster-name>]
                                --database-name <database-name> \

# Retrieves the schema of a specified Kusto table.
azmcp kusto table schema [--cluster-uri <cluster-uri> | --subscription <subscription> --cluster-name <cluster-name>]
                                  --database-name <database-name> \
                                  --table <table-name>

# Query a Kusto database
azmcp kusto query [--cluster-uri <cluster-uri> | --subscription <subscription> --cluster-name <cluster-name>]
                           --database-name <database-name> \
                           --query "<kql-query>"

# Retrieves a sample of data from a specified Kusto table.
azmcp kusto sample [--cluster-uri <cluster-uri> | --subscription <subscription> --cluster-name <cluster-name>]
                            --database-name <database-name> \
                            --table <table-name> \
                           [--limit <limit>]

Testing

  • 80% unit test coverage for all Kusto commands and base command logic.
  • Manual validation against live Kusto clusters.

Notes

  • No breaking changes to existing services or commands.

@conniey conniey moved this from Untriaged to In Progress in Azure MCP Server (OLD) Apr 22, 2025
@conniey conniey added this to the Backlog milestone Apr 22, 2025
@joshfree joshfree added onboarding New service or MCP child server to onboard Do Not Merge Do Not Merge / WIP PRs labels Apr 24, 2025
@joshfree
Copy link
Member

Tagging as Do Not Merge until this is no longer WIP

@amih90 amih90 changed the title [WIP] Add DataExplorer Operations Add DataExplorer Operations Apr 26, 2025
@amih90 amih90 marked this pull request as ready for review April 26, 2025 12:41
@amih90 amih90 requested a review from a team as a code owner April 26, 2025 12:41
@amih90 amih90 force-pushed the Add-DataExplorer-Operations branch from b4c6766 to 9d616da Compare April 26, 2025 12:47
@amih90
Copy link
Contributor Author

amih90 commented Apr 26, 2025

@joshfree PR is ready for review.

@amih90 amih90 force-pushed the Add-DataExplorer-Operations branch from 2a9b03c to bc4b48d Compare April 27, 2025 07:27
@amih90 amih90 requested review from a team and jongio as code owners April 27, 2025 07:27
@amih90 amih90 force-pushed the Add-DataExplorer-Operations branch 2 times, most recently from 42b08f6 to 9e5538d Compare April 27, 2025 07:37
@amih90 amih90 force-pushed the Add-DataExplorer-Operations branch from 9e5538d to 8a2988a Compare April 27, 2025 07:38
@joshfree joshfree removed the Do Not Merge Do Not Merge / WIP PRs label Apr 28, 2025
@joshfree joshfree requested a review from xiangyan99 April 28, 2025 16:39
@danield137
Copy link
Contributor

@amih90 you beat me to it :)
I think it would be better to stick to the cluster name and not the uri, for simplicity sake.
Here's how you'd get it:

private async Task<ICslQueryProvider> CreateKustoQueryClient(string clusterName, string? tenant = null)
{
    var credential = await GetCredential(tenant);
    var subscription = await _subscriptionService.GetSubscription(clusterName, tenant);
    var cluster = await GetCluster(subscription, clusterName);
    if (cluster == null)
    {
        throw new Exception($"Cluster '{clusterName}' not found in subscription '{subscription.Id}'");
    }

    var uri = cluster.Data.ClusterUri.ToString() ??
        throw new Exception($"Could not retrieve URI for cluster '{clusterName}'");

    var connectionStringBuilder = new KustoConnectionStringBuilder(uri)
        .WithAadAzureTokenCredentialsAuthentication(credential);

    return KustoClientFactory.CreateCslQueryProvider(connectionStringBuilder);
}

@danield137
Copy link
Contributor

also, tagging my open issue here: #45

@danield137
Copy link
Contributor

danield137 commented Apr 28, 2025

Had another discussion about this.
To clarify, the problem I have boils down to how do we make sure the agent "knows" how to map a cluster name to a cluster uri?

Right now, the description for get cluster does not clearly state that it has the uri, or that you need to use it, and I'm somewhat concerned that an agent might mistakenly come up with their own uri schema...

So, the options I see are:

  1. Change the argument to name. This has the drawback that a user can't easily point to a specific service if they want to just drop a uri, as names are not easily mapped to a uri (and vice versa).
  2. Add another command GetClutserUri. This should be straightforward for the agent to figure out the connection.
  3. Add a more explicit description for the GetCluster command, stating it returns a cluster_uri among other things.

I'm leaning towards (2), but (3) could be enough. I'll leave the decision to @xiangyan99 who is assigned :)

Ami Hollander added 2 commits May 4, 2025 14:48
@joshfree
Copy link
Member

joshfree commented May 5, 2025

On track to merge Tuesday, May 6th

@danield137
Copy link
Contributor

@joshfree , @amih90 is going to have one last round of fixes tomorrow (Israel Time), so hopefully, tomorrow EOD (PST) should be good to go.

@joshfree
Copy link
Member

joshfree commented May 6, 2025

Live tests need to also be added to the PR /cc @hallipr

Copy link
Member

@joshfree joshfree left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the contribution! Kusto support is awesome!

@joshfree joshfree merged commit fb30a6e into Azure:main May 7, 2025
15 checks passed
@github-project-automation github-project-automation bot moved this from In Progress to Done in Azure MCP Server (OLD) May 7, 2025
Tonychen0227 added a commit to Tonychen0227/azure-mcp that referenced this pull request Aug 12, 2025
* Fix diagram prompting

* Small change

* Reminder

* Fix

* Remove Mermaid Encode/Decode

---------

Co-authored-by: Tony Chen (DevDiv) <[email protected]>
g2vinay added a commit that referenced this pull request Aug 19, 2025
* onboard code to cloud tools

* fix source analysis errors

* rename iac command (#6)

* rename iac command

* revert changes

* update

* update deployment plan template

* fix comments

* fix the build error and refine the plan template

* refine the template

* add quota group (#9)

* add quota group

* add unit test

* update region checker return message

* refactor

* add unit test

* update

* revert

* [GenerateArchitectureDiagramCommand] Fix and AKS support (#8)

* init aks diagram support

* fix and test

* fix

* prompt fix encoding issue

* fix by replacing + with -

* fix encoding

* fix test

* resolve conflicts

* cspell and format

* fix the iac-rules-get tool name in e2etestprompt.md

* Refactor: extract prompt to md file (#10)

* fix

* extract prompt to md file

* rename available-region-list

* clean code (#11)

* clean code

* update

* add deploy command in md and fix analyze error

* Some fix according to e2e test (#12)

* fix prompt for test

* format

* update

* fix

* update

* update

* add rules

* Refactor deploy&quota to project

* fix test failure

* Add sub command description to goup description

* update description based on comment

* fix live test (#13)

* fix live test

* update quota test

* update

* update cspell (#14)

* force to save plan to file (#15)

* update plan command description

* Add PR guidance document

* Add test scenarios

* aot safe refactoring and update template md (#16)

* aot safe refactoring

* update template md

* move app topology definition to resource file and update the command extension implementation

* update test result - not completed

* update test result

* reorganize file folders (#17)

* reorganize file folders

* update test structure

* update pipeline template

* format

* remove comments

* fix

* update the command names in md file

* Add code review report for PR #626 on Deploy and Quota commands

* fix the comments in code review report

* remove code review doc

* fix test failure

* Add code review report for PR #626 addressing deploy and quota commands

- Summarized findings and compliance with architectural guidelines
- Documented command structure, integration issues, and AOT safety
- Provided targeted recommendations and next steps for improvements
- Included exhaustive merge-readiness checklist and quick quality gates snapshot
- Suggested documentation deltas and compliance matrix against final recommendations

* Add manual testing plan and update documentation checklist for PR #626

* update action plan and add invalid json test case

* feat: Add comprehensive unit tests for quota commands (#19)

- Add edge case tests for whitespace-only resource types
- Add tests for mixed casing in resource types with proper case preservation
- Add tests for very long resource types lists (50+ items)
- Enhance test coverage for AvailabilityListCommand and CheckCommand
- Ensure proper validation and error handling for edge cases

* lint (#20)

* Chentony/mermaid response refactor (#21)

* Fix diagram prompting

* Small change

* Reminder

* Fix

* Remove Mermaid Encode/Decode

---------

Co-authored-by: Tony Chen (DevDiv) <[email protected]>

* fix cspell errors

* Mermaid generation: Fix </br> hallucination, fix copilotmd file target, fix extension installation reminder (#22)

* Fix diagram prompting

* Small change

* Reminder

* Fix

* Remove Mermaid Encode/Decode

* Fix </br> hallucination, fix copilotmd file target, fix extension installation reminder

---------

Co-authored-by: Tony Chen (DevDiv) <[email protected]>

* feat: Add remaining work items for Deploy & Quota command areas

* feat: Add test execution log section to Manual Testing Plan for Copilot prompts

* Xf/updatecomm2 (#23)

* add logger

* Hard-coded endpoints

* update GetQuotaByUrlAsync

* update Error handling

* update doc

* HTTP usage pattern

* doc

* format

* format

* add test

* update

* aot check

* update document

* update the remaining work

* fix parser (#24)

* update remaining work

* Adds document describing tool organization tasks

* Updated organization task priorities

* Add 32 character max for resource names (#25)

Co-authored-by: Tony Chen (DevDiv) <[email protected]>

* fix build error and comments

* remove image

* Update Directory.Packages.props

update ARM versions

* Update cspell.json

fix cspell json

* Update sign-and-pack.yml

add YamlDotNet.dll to allow list

---------

Co-authored-by: xfz11 <[email protected]>
Co-authored-by: wchigit <[email protected]>
Co-authored-by: Vinay Gera <[email protected]>
Co-authored-by: Jon Gallant <[email protected]>
Co-authored-by: Tonychen0227 <[email protected]>
Co-authored-by: Tony Chen (DevDiv) <[email protected]>
Co-authored-by: Wallace Breza <[email protected]>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

onboarding New service or MCP child server to onboard

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

7 participants