Add CI test to validate Azure MCP tool names in skill markdown files#1709
Add CI test to validate Azure MCP tool names in skill markdown files#1709
Conversation
…eferences Agent-Logs-Url: https://github.com/microsoft/GitHub-Copilot-for-Azure/sessions/362a2400-266c-4070-9a8b-625601205ea3 Co-authored-by: kvenkatrajan <102772054+kvenkatrajan@users.noreply.github.com>
|
@copilot - bump the version on 'azure-cloud-migrate' , 'azure-prepare', 'azure-upgrade' skills |
…de skills Agent-Logs-Url: https://github.com/microsoft/GitHub-Copilot-for-Azure/sessions/5a67a30f-b6d1-43a9-8c38-a2ad05209e1b Co-authored-by: kvenkatrajan <102772054+kvenkatrajan@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Adds automated validation to ensure Azure MCP tool names referenced in skill markdown stay in sync with the tools actually exposed by @azure/mcp, and fixes existing stale tool references found by that validation.
Changes:
- Add a new unit test that boots
@azure/mcpand validates referenced Azure MCP tool names acrossplugin/skills/**/*.md. - Fix stale tool references (
get_bestpractices→get_azure_bestpractices) across affected skill docs. - Update azure-upgrade and azure-cloud-migrate SKILL tool lists/usages to the corrected tool name.
Show a summary per file
| File | Description |
|---|---|
| tests/skills-validation/mcp-tool-names.test.ts | New unit test that queries Azure MCP tools/list and validates tool references in skill markdown. |
| plugin/skills/azure-upgrade/SKILL.md | Fixes Azure MCP best-practices tool name in rules/tool table. |
| plugin/skills/azure-upgrade/references/services/functions/assessment.md | Fixes best-practices tool reference in tip. |
| plugin/skills/azure-upgrade/references/global-rules.md | Fixes best-practices tool reference in global rules. |
| plugin/skills/azure-prepare/references/recipes/terraform/README.md | Fixes best-practices tool reference in Terraform recipe table. |
| plugin/skills/azure-prepare/references/recipes/azcli/README.md | Fixes best-practices tool reference in Azure CLI recipe table. |
| plugin/skills/azure-cloud-migrate/SKILL.md | Fixes Azure MCP best-practices tool name in rules. |
| plugin/skills/azure-cloud-migrate/references/services/functions/global-rules.md | Fixes best-practices tool reference in rules. |
| plugin/skills/azure-cloud-migrate/references/services/functions/code-migration.md | Fixes best-practices tool reference in prerequisites/steps. |
| plugin/skills/azure-cloud-migrate/references/services/functions/assessment.md | Fixes best-practices tool reference in tip. |
Copilot's findings
- Files reviewed: 11/11 changed files
- Comments generated: 3
|
Fixes #778 |
Agent-Logs-Url: https://github.com/microsoft/GitHub-Copilot-for-Azure/sessions/bfd49079-1961-4c4e-b89f-d5e1a195b0ac Co-authored-by: kvenkatrajan <102772054+kvenkatrajan@users.noreply.github.com>
jongio
left a comment
There was a problem hiding this comment.
The approach works well - validating tool names against the live server catches drift that's hard to spot manually, and the 9 fixes prove the test's value.
Three suggestions on the test implementation, plus a note that the PR currently has merge conflicts to resolve.
| // Tests | ||
| // --------------------------------------------------------------------------- | ||
|
|
||
| describe("Azure MCP Tool Name Validation", () => { |
There was a problem hiding this comment.
This test spawns a live MCP server, needs npm registry access, and has a 120s timeout - the firewall warnings in the PR description show it can't run in all CI environments. Consider either moving it to an integration test path or extracting a static tool-name snapshot for unit tests (with a separate integration test to keep the snapshot fresh).
There was a problem hiding this comment.
Done in commit c38ddb5. Added tests/skills-validation/azure-mcp-tools.json (snapshot of the 61 tools currently exposed by @azure/mcp) and replaced the live-server logic in the test with a synchronous fs.readFileSync call. The child_process import and the 120s beforeAll timeout are gone — the test now completes in ~2s.
…mes test Agent-Logs-Url: https://github.com/microsoft/GitHub-Copilot-for-Azure/sessions/3db4fef5-f378-4506-83b4-7a2f8ee1c5d4 Co-authored-by: kvenkatrajan <102772054+kvenkatrajan@users.noreply.github.com>
…apshot in unit test - Add tests/skills-validation/azure-mcp-tools.json with current tool list from @azure/mcp - Refactor mcp-tool-names.test.ts to read from snapshot (fast, offline, deterministic) - Remove spawn/child_process dependency, 120s beforeAll timeout, and live server logic - Test now completes in ~2s instead of up to 2 minutes Agent-Logs-Url: https://github.com/microsoft/GitHub-Copilot-for-Azure/sessions/123eec45-bcc4-4e61-815f-89ffe090b2da Co-authored-by: kvenkatrajan <102772054+kvenkatrajan@users.noreply.github.com>
|
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
jongio
left a comment
There was a problem hiding this comment.
Previous feedback addressed cleanly - the snapshot approach eliminates the live-server dependency, the 120s timeout, and the Windows spawn issue in one shot.
One remaining observation on the regex (inline). PR is also currently CONFLICTING with main - needs a rebase before it can merge.
| const MCP_AZURE_MCP_RE = /mcp_azure_mcp_([a-z][a-z0-9_]*)/g; | ||
| // Matches: azure__<tool> | ||
| const AZURE_DOUBLE_UNDERSCORE_RE = /azure__([a-z][a-z0-9_]*)/g; | ||
|
|
There was a problem hiding this comment.
Greedy match is fine today because every azure__<tool> in current skills is bounded by backticks or whitespace - I grepped. But if a skill ever writes the MCP function-call form azure__storage_blob_list as a single token, this will fail: greedy capture grabs storage_blob_list, which isn't in the snapshot (only storage is).
Two low-cost options if you want to harden it:
- After extracting the suffix, try progressively shorter prefixes down to the first underscore before declaring invalid.
- Leave it strict and document the convention in the snapshot header so authors know compound forms aren't supported.
Not a blocker - current skills are all safe. Flagging it as latent so it doesn't surprise someone in 6 months.
Skill markdown files reference Azure MCP tools by name, but there was no automated check to catch stale or mistyped tool names that don't match what the server actually exposes.
Changes
New test
tests/skills-validation/mcp-tool-names.test.ts— unit test that runs as part of the existingtest:unitsuite (picked up by thetest-all-skills.ymlCI workflow). It:tests/skills-validation/azure-mcp-tools.json— fast, offline, and deterministic (no live server, no npm registry access, no 120s timeout).mdfiles underplugin/skills/for two naming conventions:mcp_azure_mcp_<tool>(GitHub Copilot MCP tool reference format)azure__<tool>(alternative format)New snapshot
tests/skills-validation/azure-mcp-tools.json— static list of the 61 tool names currently exposed by@azure/mcp server start. Update this file when new tools are added to the server (tracked in issue Add scheduled CI workflow to refresh MCP tool name snapshot #1933).Bug fixes in 9 MD files — discovered by the new test:
mcp_azure_mcp_get_bestpracticesis not a real tool; the correct name ismcp_azure_mcp_get_azure_bestpractices. Fixed acrossazure-upgrade,azure-cloud-migrate, andazure-prepareskill reference files.Failure output example
When a file references a non-existent tool, the test produces: