Skip to content

Add CI test to validate Azure MCP tool names in skill markdown files#1709

Open
Copilot wants to merge 6 commits intomainfrom
copilot/add-ci-test-for-azure-mcp-tools
Open

Add CI test to validate Azure MCP tool names in skill markdown files#1709
Copilot wants to merge 6 commits intomainfrom
copilot/add-ci-test-for-azure-mcp-tools

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 3, 2026

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 existing test:unit suite (picked up by the test-all-skills.yml CI workflow). It:

    • Reads the valid tool list from a static snapshot file tests/skills-validation/azure-mcp-tools.json — fast, offline, and deterministic (no live server, no npm registry access, no 120s timeout)
    • Recursively scans all .md files under plugin/skills/ for two naming conventions:
      • mcp_azure_mcp_<tool> (GitHub Copilot MCP tool reference format)
      • azure__<tool> (alternative format)
    • Fails with file path + line number diagnostics for every invalid tool name found
  • 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_bestpractices is not a real tool; the correct name is mcp_azure_mcp_get_azure_bestpractices. Fixed across azure-upgrade, azure-cloud-migrate, and azure-prepare skill reference files.

Failure output example

When a file references a non-existent tool, the test produces:

● all Azure MCP tool names referenced in skill markdown files are valid

  expect(received).toHaveLength(0)

  Received:
    ["azure-upgrade/SKILL.md:28 — "get_bestpractices" is not a valid Azure MCP tool name",
     ...]

Copilot AI changed the title [WIP] Add CI tests for validating Azure MCP tool names in markdown files Add CI test to validate Azure MCP tool names in skill markdown files Apr 3, 2026
Copilot AI requested a review from kvenkatrajan April 3, 2026 21:55
@kvenkatrajan kvenkatrajan marked this pull request as ready for review April 3, 2026 21:59
Copilot AI review requested due to automatic review settings April 3, 2026 21:59
@kvenkatrajan
Copy link
Copy Markdown
Collaborator

@copilot - bump the version on 'azure-cloud-migrate' , 'azure-prepare', 'azure-upgrade' skills

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Apr 3, 2026

@copilot - bump the version on 'azure-cloud-migrate' , 'azure-prepare', 'azure-upgrade' skills

Done in commit 243a564. Bumped versions for the three modified skills:

  • azure-cloud-migrate: 1.0.1 → 1.0.2
  • azure-prepare: 1.1.6 → 1.1.7
  • azure-upgrade: 1.0.0 → 1.0.1

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

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/mcp and validates referenced Azure MCP tool names across plugin/skills/**/*.md.
  • Fix stale tool references (get_bestpracticesget_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

Comment thread tests/skills-validation/mcp-tool-names.test.ts Outdated
Comment thread plugin/skills/azure-upgrade/SKILL.md
Comment thread plugin/skills/azure-cloud-migrate/SKILL.md
@kvenkatrajan
Copy link
Copy Markdown
Collaborator

Fixes #778

Copy link
Copy Markdown
Collaborator

@jongio jongio left a comment

Choose a reason for hiding this comment

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

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.

Comment thread tests/skills-validation/mcp-tool-names.test.ts Outdated
Comment thread tests/skills-validation/mcp-tool-names.test.ts Outdated
// Tests
// ---------------------------------------------------------------------------

describe("Azure MCP Tool Name Validation", () => {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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).

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Ive created - #1933 to update MCP tool snapshot

@copilot - implement Jon's suggestion on unit test Reads azure-mcp-tools.json (fast, offline, deterministic)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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.

Copilot AI review requested due to automatic review settings April 17, 2026 16:00
…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>
Copilot AI requested review from Copilot and removed request for Copilot April 17, 2026 16:25
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Apr 17, 2026

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:

  • centralus-2.in.applicationinsights.azure.com
    • Triggering command: /home/REDACTED/.npm/_npx/541454632b79112e/node_modules/@azure/mcp-linux-x64/dist/azmcp /home/REDACTED/.npm/_npx/541454632b79112e/node_modules/@azure/mcp-linux-x64/dist/azmcp server start (dns block)
  • westus-0.in.applicationinsights.azure.com
    • Triggering command: /home/REDACTED/.npm/_npx/541454632b79112e/node_modules/@azure/mcp-linux-x64/dist/azmcp /home/REDACTED/.npm/_npx/541454632b79112e/node_modules/@azure/mcp-linux-x64/dist/azmcp server start (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copy link
Copy Markdown
Collaborator

@jongio jongio left a comment

Choose a reason for hiding this comment

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

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;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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:

  1. After extracting the suffix, try progressively shorter prefixes down to the first underscore before declaring invalid.
  2. 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.

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.

PR CI tests for ensuring that the tool names in md file reflect actual Azure MCP server tools

4 participants