Skip to content

Add script to validate existence of E2E prompt tool. Update const used in ToolListCommand#3034

Open
conniey wants to merge 8 commits into
microsoft:mainfrom
conniey:add-folder-metadata
Open

Add script to validate existence of E2E prompt tool. Update const used in ToolListCommand#3034
conniey wants to merge 8 commits into
microsoft:mainfrom
conniey:add-folder-metadata

Conversation

@conniey

@conniey conniey commented Jul 14, 2026

Copy link
Copy Markdown
Member

What does this PR do?

  • Update ToolListCommand to use const Separator (in case it is changed in the future)
  • Adds an analyze step that ensures E2E test prompts use MCP tools that exists in the server’s real tool list.

GitHub issue number?

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

Copilot AI review requested due to automatic review settings July 14, 2026 21:45
@conniey conniey requested review from a team as code owners July 14, 2026 21:45
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).
There may be pipelines that require an authorized user to comment /azp run to run.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds CI-side validation to ensure documented E2E tool-selection prompts reference real, runtime-available MCP tools, and tightens tool name tokenization to rely on the shared separator constant.

Changes:

  • Added Test-ToolSelectionPrompts.ps1 to build servers and validate e2eTestPrompts.md tool names against tools list --name-only.
  • Updated Analyze-Code.ps1 to run the new prompt validation step during analysis.
  • Updated ToolsListCommand to use CommandFactory.Separator when constructing surfaced tool names; updated tool-length validation to consume --name-only output.

Invoking Livetests

Copilot submitted PRs are not trustworthy by default. Users with write access to the repo need to validate the contents of this PR before leaving a comment with the text /azp run mcp - pullrequest - live. This will trigger the necessary livetest workflows to complete required validation.

Reviewed changes

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

Show a summary per file
File Description
eng/scripts/Test-ToolSelectionPrompts.ps1 New script that builds servers and validates prompt tool names against runtime tool inventory.
eng/scripts/Analyze-Code.ps1 Wires the new prompt validation into the analysis workflow.
eng/scripts/Test-ToolNameLength.ps1 Switches tool enumeration to tools list --name-only and simplifies length checks.
eng/scripts/Test-ToolId.ps1 Removes an unused variable.
core/Microsoft.Mcp.Core/src/Areas/Tools/Commands/ToolsListCommand.cs Uses the shared tool-name separator constant when generating surfaced tool IDs.

Comment on lines +67 to +71
if ($LASTEXITCODE -ne 0) {
Write-Host "❌ E2E tool prompt validation failed."
} else {
Write-Host "✅ E2E tool prompt validation did not detect any issues."
}
Comment on lines +64 to +66
# Run tool prompt validation
& "$PSScriptRoot/Test-ToolSelectionPrompts.ps1"

Comment on lines +140 to +142
# Use the build infrastructure - New-BuildInfo.ps1 and Build-Code.ps1
$buildInfoPath = "$RepoRoot/.work/build_info.json"
$buildOutputPath = "$RepoRoot/.work/build"
Comment on lines +165 to +168
# Build the servers
$platformName = Get-PlatformName
& "$RepoRoot/eng/scripts/Build-Code.ps1" -BuildInfoPath $buildInfoPath -PlatformName $platformName

Comment on lines +145 to +149
if ($ServerName) {
Write-Host "Validating tool name length for $ServerName"
} else {
Write-Host "Validating tool name length for all servers"
}

@RickWinter RickWinter left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This PR adds an E2E prompt tool-existence validation script and updates the tool-list constant. The new gate can report success without checking any prompt when every server is skipped. That execution path must fail before merge.

}
}

if ($violationsCount -eq 0) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

When every server is skipped because tools list fails or returns no names, $violationsCount remains zero and this exits successfully. The new CI gate can pass without validating any prompt. Track successful validations and fail when none run, as Test-ToolNameLength.ps1 does.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants