Skip to content

Allow KQL comments and let statements#2385

Merged
xiangyan99 merged 2 commits intomainfrom
kusto_let_comment
Apr 10, 2026
Merged

Allow KQL comments and let statements#2385
xiangyan99 merged 2 commits intomainfrom
kusto_let_comment

Conversation

@xiangyan99
Copy link
Copy Markdown
Member

What does this PR do?

[Provide a clear, concise description of the changes]

[Add additional context, screenshots, or information that helps reviewers]

GitHub issue number?

[Link to the GitHub issue this PR addresses]

#2383

Pre-merge Checklist

  • Required for All PRs
    • Read contribution guidelines
    • PR title clearly describes the change
    • Commit history is clean with descriptive messages (cleanup guide)
    • Added comprehensive tests for new/modified functionality
    • Created a changelog entry if the change falls among the following: new feature, bug fix, UI/UX update, breaking change, or updated dependencies. Follow the changelog entry guide
  • For MCP tool changes:
    • One tool per PR: This PR adds or modifies only one MCP tool for faster review cycles
    • Updated servers/Azure.Mcp.Server/README.md and/or servers/Fabric.Mcp.Server/README.md documentation
    • Validate README.md changes running the script ./eng/scripts/Process-PackageReadMe.ps1. See Package README
    • For new or modified tool descriptions, ran ToolDescriptionEvaluator and obtained a score of 0.4 or more and a top 3 ranking for all related test prompts
    • For tools with new names, including new tools or renamed tools, update consolidated-tools.json
    • For renamed tools, follow the Tool Rename Checklist and tag the PR with the breaking-change label
    • For new tools associated with Azure services or publicly available tools/APIs/products, add URL to documentation in the PR description
  • Extra steps for Azure MCP Server tool changes:
    • Updated command list in servers/Azure.Mcp.Server/docs/azmcp-commands.md
    • Ran ./eng/scripts/Update-AzCommandsMetadata.ps1 to update tool metadata in azmcp-commands.md (required for CI)
    • Updated test prompts in servers/Azure.Mcp.Server/docs/e2eTestPrompts.md
    • 👉 For Community (non-Microsoft team member) PRs:
      • Security review: Reviewed code for security vulnerabilities, malicious code, or suspicious activities before running tests (crypto mining, spam, data exfiltration, etc.)
      • Manual tests run: added comment /azp run mcp - pullrequest - live to run Live Test Pipeline

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the Kusto KQL query validator to permit common, read-only KQL constructs (line comments and let/semicolon usage) that were previously rejected, aligning tool behavior with real-world KQL usage while still blocking tautology injections and management commands.

Changes:

  • Remove the rule that blocks // comments in KQL queries.
  • Remove the rule that blocks semicolons / multiple statements (enabling let ...; patterns).
  • Add/update unit tests and add a changelog entry documenting the behavior change.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
tools/Azure.Mcp.Tools.Kusto/src/Validation/KqlQueryValidator.cs Removes comment and semicolon rejection logic, leaving tautology + management-command checks in place.
tools/Azure.Mcp.Tools.Kusto/tests/Azure.Mcp.Tools.Kusto.UnitTests/KqlQueryValidatorTests.cs Updates tests to expect comments/let/semicolons to be allowed; refines management-command test coverage.
servers/Azure.Mcp.Server/changelog-entries/1775838003897.yaml Documents the validator behavior change as a bug fix.

Comment thread tools/Azure.Mcp.Tools.Kusto/src/Validation/KqlQueryValidator.cs Outdated
Comment thread tools/Azure.Mcp.Tools.Kusto/src/Validation/KqlQueryValidator.cs
@github-project-automation github-project-automation bot moved this from Untriaged to In Progress in Azure MCP Server Apr 10, 2026
@xiangyan99 xiangyan99 merged commit 3cb2123 into main Apr 10, 2026
15 checks passed
@xiangyan99 xiangyan99 deleted the kusto_let_comment branch April 10, 2026 22:55
@github-project-automation github-project-automation bot moved this from In Progress to Done in Azure MCP Server Apr 10, 2026
xiangyan99 added a commit that referenced this pull request Apr 10, 2026
* Allow KQL comments and let statements

* updates
xiangyan99 added a commit that referenced this pull request Apr 10, 2026
* Allow KQL comments and let statements (#2385)

* Allow KQL comments and let statements

* updates

* add test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants