Repository navigation
Update export tool discovery description for Azure Terraform tools - #3737
Conversation
Make export intent visible in namespace and individual tool descriptions while preserving local command generation. Cover discovery, routing, provider forwarding, installation help, and HTTP restrictions with regression tests. Disambiguate tools that competed for the same prompts by keying each description on its distinguishing selection signal. The aztfexport resource tool leads with the full Azure resource ID shape and states it exports only that resource, while the resourcegroup tool keys on a named resource group. The azurerm and azapi documentation tools state that they read reference documentation rather than querying live Azure resources, and identify their inputs by the azurerm_ prefix and the ARM namespace format respectively. The conftest workspace and plan tools distinguish a folder of Terraform .tf source files from an already generated tfplan.json. Validated with the tool description evaluator against the azureterraform prompts, which improved top-choice selection from 70.0% to 93.3%, with all prompts remaining above the 0.40 confidence bar. Add a checked-in Vally specification covering the prompts reported in the issue plus the tool pairs that compete for similar prompts. The conftest prompts in e2eTestPrompts.md are marked context-required and are therefore skipped by generated specifications, so the checked-in specification is the only Vally coverage for them. Pin the disambiguating phrases with unit tests so that rewording a description cannot silently regress tool selection. Addresses microsoft#3553 Co-authored-by: Copilot App <[email protected]>
|
Azure Pipelines: Successfully started running 1 pipeline(s). There may be pipelines that require an authorized user to comment /azp run to run. |
|
Azure Pipelines: Successfully started running 1 pipeline(s). There may be pipelines that require an authorized user to comment /azp run to run. |
There was a problem hiding this comment.
Copilot review overview
🔵 Needs a closer look
AzureRM documentation wording incorrectly implies the azurerm_ prefix is mandatory, risking valid unprefixed lookups.
Review effort: Lite
Findings: None
What changed in this PR
Improves Azure Terraform tool discovery and routing descriptions without changing runtime behavior.
Changes:
- Clarifies export, documentation, and Conftest tool descriptions.
- Adds routing, discovery, and evaluation coverage.
- Updates prompts, command documentation, and changelog.
| File | Reviewed change |
|---|---|
tools/Azure.Mcp.Tools.AzureTerraform/tests/eval.yaml |
Adds tool-selection evaluation prompts. |
tools/Azure.Mcp.Tools.AzureTerraform/tests/Azure.Mcp.Tools.AzureTerraform.Tests/AzureTerraformToolDescriptionTests.cs |
Verifies key description phrases. |
tools/Azure.Mcp.Tools.AzureTerraform/tests/Azure.Mcp.Tools.AzureTerraform.Tests/AztfexportToolLoadingTests.cs |
Tests discovery, routing, filtering, and installation handling. |
tools/Azure.Mcp.Tools.AzureTerraform/src/Commands/Conftest/ConftestWorkspaceValidationCommand.cs |
Clarifies workspace validation input. |
tools/Azure.Mcp.Tools.AzureTerraform/src/Commands/Conftest/ConftestPlanValidationCommand.cs |
Clarifies plan-file validation input. |
tools/Azure.Mcp.Tools.AzureTerraform/src/Commands/AzureRMDocsGetCommand.cs |
Clarifies AzureRM documentation lookup. |
tools/Azure.Mcp.Tools.AzureTerraform/src/Commands/AztfexportResourceGroupCommand.cs |
Clarifies resource-group export behavior. |
tools/Azure.Mcp.Tools.AzureTerraform/src/Commands/AztfexportResourceCommand.cs |
Clarifies resource-ID export behavior. |
tools/Azure.Mcp.Tools.AzureTerraform/src/Commands/AzApiDocsGetCommand.cs |
Clarifies ARM-format documentation lookup. |
tools/Azure.Mcp.Tools.AzureTerraform/src/AzureTerraformSetup.cs |
Expands the namespace description. |
servers/Azure.Mcp.Server/docs/e2eTestPrompts.md |
Adds targeted discovery prompts. |
servers/Azure.Mcp.Server/docs/azmcp-commands.md |
Updates command descriptions. |
servers/Azure.Mcp.Server/changelog-entries/liuwuliuyun-terraform-export-discovery.yaml |
Records the bug fix. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
Hi Yun Liu (@liuwuliuyun) , i closed this issue because I was unable to repro the issue - #3553. Do you still want to make these changes? |
E2E evidence: baseline compared with this PRI ran the three prompts from #3553 and the resource ID prompt from The runs covered namespace mode (the server default) and all-tools mode. The harness used Copilot SDK and runtime versions
Findings
|
|
Thanks for sharing the testing evidence, looks good to me. Please resolve the conflicts and we can merge this PR. Please feel free to create an issue and link to it |
Resolve the AzureTerraformSetup namespace description conflict by keeping main's concatenated-line format (microsoft#3786) with this PR's expanded aztfexport wording. Co-authored-by: Copilot App <[email protected]>
Replace the ambiguous 'optionally for a specific API version' phrase with an explicit statement that the tool returns the latest stable API version schema unless a specific API version is requested. Co-authored-by: Copilot App <[email protected]>
* Fix advisor remediation deserialization for double version (#3880) * Update export tool discovery description for Azure Terraform tools (#3737) * fix(azureterraform): clarify export tool discovery Make export intent visible in namespace and individual tool descriptions while preserving local command generation. Cover discovery, routing, provider forwarding, installation help, and HTTP restrictions with regression tests. Disambiguate tools that competed for the same prompts by keying each description on its distinguishing selection signal. The aztfexport resource tool leads with the full Azure resource ID shape and states it exports only that resource, while the resourcegroup tool keys on a named resource group. The azurerm and azapi documentation tools state that they read reference documentation rather than querying live Azure resources, and identify their inputs by the azurerm_ prefix and the ARM namespace format respectively. The conftest workspace and plan tools distinguish a folder of Terraform .tf source files from an already generated tfplan.json. Validated with the tool description evaluator against the azureterraform prompts, which improved top-choice selection from 70.0% to 93.3%, with all prompts remaining above the 0.40 confidence bar. Add a checked-in Vally specification covering the prompts reported in the issue plus the tool pairs that compete for similar prompts. The conftest prompts in e2eTestPrompts.md are marked context-required and are therefore skipped by generated specifications, so the checked-in specification is the only Vally coverage for them. Pin the disambiguating phrases with unit tests so that rewording a description cannot silently regress tool selection. Addresses #3553 Co-authored-by: Copilot App <[email protected]> * Clarify AzAPI docs API version wording Replace the ambiguous 'optionally for a specific API version' phrase with an explicit statement that the tool returns the latest stable API version schema unless a specific API version is requested. Co-authored-by: Copilot App <[email protected]> --------- Co-authored-by: Copilot App <[email protected]> * feat(fabric): add read-only core_get-item tool (#3701) * feat(fabric): add read-only core get-item tool ## Summary Add core_get-item to retrieve generic Fabric item metadata using known workspace and item IDs. Include input validation, typed results, safe retry guidance, registration, tests, documentation, prompts, and a changelog entry. ## Prompting Intent The contributor requested one focused Fabric MCP tool, aligned with existing repository patterns, with no item data or definition access and no authentication changes. Preserve the existing creation and catalog-search behavior, address review findings, and submit a draft PR with incomplete validation explicitly identified. ## Linked Sources - Fabric Get Item API: https://learn.microsoft.com/rest/api/fabric/core/items/get-item - Contribution guide: https://github.com/microsoft/mcp/blob/main/CONTRIBUTING.md - Command options guide: https://github.com/microsoft/mcp/blob/main/docs/option-conversion.md - Recorded test guide: https://github.com/microsoft/mcp/blob/main/docs/recorded-tests.md - Description evaluator: https://github.com/microsoft/mcp/blob/main/eng/tools/ToolDescriptionEvaluator/Quickstart.md - Fabric test infrastructure: #3686 ## Rationale Keep string service inputs consistent with existing Core operations while validating and normalizing UUIDs before authentication. Use a dedicated metadata projection so definitions and workload-specific fields cannot leak into the result. Factor HTTP sending only to let the new read inspect status and Retry-After while preserving existing create/search handling. Use source-generated JSON and the shared MCP loader rather than another schema or execution path. Keep backend bodies out of errors and validate the registered tool with offline HTTP and credential substitutes. All 118 Core tests, owning-project formatting, the Fabric host build, XML documentation compilation, and spelling passed. Native validation and bounded manual live reads also passed before the documentation-only follow-up. Description scoring and the required Fabric integration coverage remain pending maintainer coordination. Co-authored-by: Copilot <[email protected]> * fix(ci): keep tool catalog stderr out of JSON ## Summary Stop merging native stderr into the JSON consumed by the tool-selection prompt validator. Add four Pester regression tests for stdout parsing, visible stderr diagnostics, and rejection of invalid or contaminated stdout. ## Prompting Intent The contributor asked to fix the failed Analyze check in PR #3701 and update the existing PR. Keep the change limited to the validator and regression coverage, preserve strict prompt validation, and do not change the Fabric tool or suppress validation errors. ## Linked Sources - PR: #3701 - Failing Analyze check: https://github.com/microsoft/mcp/runs/105130046877 - Validator: https://github.com/microsoft/mcp/blob/3acf0c58036a14e9be308898153053fc98a33019/eng/scripts/Test-ToolSelectionPrompts.ps1 ## Rationale Fabric correctly writes its tool catalog to stdout and startup diagnostics to stderr. The validator's merged capture made valid JSON unparseable. Removing the redirection preserves diagnostics and existing exit handling while parsing only stdout. The regression tests execute the actual capture and parse statements rather than a duplicate implementation. All four Pester tests passed. Build-Local.ps1 -ServerName Fabric.Mcp.Server -VerifyNpx passed in a non-interactive process. The full Fabric prompt validator passed with 49 tools, one server tested, zero skips, and zero violations. The negative check still rejected prompts for tools outside the Fabric catalog. Spelling and whitespace checks passed. Co-authored-by: Copilot <[email protected]> * feat(fabric): add read-only core_get-workspace tool Co-authored-by: Copilot App <[email protected]> * feat(fabric): add read-only core_list-workspaces tool Co-authored-by: Copilot App <[email protected]> * feat(fabric): add read-only core_list-items tool Add paginated workspace and folder inventory with typed metadata, safe continuation encoding, and sanitized failures. Cover the command, service, MCP pipeline, and local discovery without live Fabric requests. Co-authored-by: Copilot App <[email protected]> * feat(fabric): add core_create-workspace with capacity support Create Fabric workspaces in one synchronous request with optional capacity and domain assignment, typed metadata, guarded inputs, sanitized errors, and offline coverage. Co-authored-by: Copilot App <[email protected]> * feat(fabric): add core_update-workspace tool Co-authored-by: Copilot App <[email protected]> * feat(fabric): add core_update-item tool Add validated metadata-only item updates with omitted and empty description semantics, source-generated output, and offline command/service/MCP coverage. Co-authored-by: Copilot App <[email protected]> * feat(fabric): add core_delete-item with explicit hard-delete opt-in Co-authored-by: Copilot App <[email protected]> * feat(fabric): add core_delete-workspace tool Co-authored-by: Copilot App <[email protected]> * Add submit-only Fabric workspace capacity assignment Co-authored-by: Copilot App <[email protected]> * Format assignment registration coverage Co-authored-by: Copilot App <[email protected]> * fix(fabric): preserve create and catalog search HTTP errors Preserve response status in EnsureSuccessAsync and add operation-local HTTP guidance without changing shared error handling, result shapes, or retries. Cover service and command regressions, update old status-loss assertions, and add a Fabric bug-fix changelog entry. Co-authored-by: Copilot App <[email protected]> * fix(fabric): sanitize errors and validate creation and paging Sanitize Create Item and Catalog Search public errors without changing status mappings or success contracts. Validate workspace UUIDs with the compatible alias, reject mixed catalog continuation criteria, document verified requirements, and correct Update Item error punctuation. Cover serialized Debug/Release errors and command/service validation. Co-authored-by: Copilot App <[email protected]> * fix(fabric): honor workspace contracts and deletion safety Make workspace type optional across get, list, create, and update; retain configured HTTP transports while disabling automatic redirects; preserve confirmed delete responses during late cancellation and improve upstream 400 guidance. Correct all 23 invalid prompt interaction cells without changing 37 prompts, and add regression coverage and documentation. Co-authored-by: Copilot App <[email protected]> * fix(fabric): share sanitized errors and retain missing-option guidance Report only registered required option names for Create Item validation failures while keeping parser details private. Centralize null exception results in an AOT-safe Fabric command base and consolidate five identical throttling exceptions without changing operation-specific errors, retry contracts, or deletion modes. Co-authored-by: Copilot App <[email protected]> * fix(fabric): sanitize shared Core parser errors Sanitize structured parser failures after the framework handler while preserving required-option guidance and command-specific overrides. Cover real Boolean binding, unknown options, required-name allowlisting, and blank workspace-name parser failures without changing services or legacy creation behavior. Co-authored-by: Copilot App <[email protected]> * test(fabric): centralize Core catalog expectations Keep one independent expected catalog for exact command and MCP discovery, read-only membership, singleton registration, and schema consistency. Preserve operation-specific tests while removing unrelated catalog copies and fragile host totals. Cover missing, extra, duplicate, and misclassified entries in both catalog modes and document the one-entry workflow for future tools. Co-authored-by: Copilot App <[email protected]> --------- Co-authored-by: Copilot <[email protected]> Co-authored-by: Amos Hersch <[email protected]> * Add Fabric LRO tracking and bounded Create Item polling (#3892) Add Fabric operation-state and operation-result tools, shared hybrid LRO handling, and optional bounded Create Item polling. Keep a 120-second default with a server-enforced 600-second maximum, resumable receipts, and no automatic resubmission of the initiating mutation. Integrate the merged Get Item tooling and centralized catalog coverage. Co-authored-by: Copilot App <[email protected]> * Update Fabric REST API specifications and item definition documentation (#3914) * Refresh Fabric static resources with a reusable updater Refresh pinned REST API specifications and item-definition articles, preserve source bytes and attribution, and add a guarded two-step manual refresh with focused regression coverage. Co-authored-by: Copilot App <[email protected]> * Remove generated Fabric resource metadata Keep source revisions in refresh results and required attribution in the existing Docs README. Stop embedding license and source manifests without changing API specifications or article content. Co-authored-by: Copilot App <[email protected]> * Limit Fabric refresh PR to updated resources Remove repository maintenance tooling and restore baseline attributes and tests. Exclude the legacy Ontology article while preserving all remaining resource blobs. Co-authored-by: Copilot App <[email protected]> --------- Co-authored-by: Copilot App <[email protected]> * Add URL validation for all ArmClient uses and add DNS->IP address resolution SSRF protections. (#3884) * Add URL validation for all ArmClient uses and add DNS->IP address resolution SSRF protections. Introduce IEndpointValidator for improved unit testing and parallel test execution. Update documentation accordingly. And a bunch of follow up squashed commits below... Fix Fabric test compilation errors Remove added difficulty around ServiceStartCommand testing. Slight tinkering to HttpClientFactoryConfigurator. Fix using sorting in NamespaceUpdateCommandTests.cs Fix Speech live test regression caused by #3282. Stabilize LoopbackHttpServer on macOS. Application of IP address vs DefaultProxy is now calculated per-request due to dynamic nature of DefaultProxy, PACs, etc. Also other PR feedback. More doc updates for using a proxy vs not and IP address filtering applied. Remove NoSsrfClientName and disable auto-redirect for _all_ HttpClient instances of DI. Enable NO_PROXY to hit the IP address filtering logic just like if a system/PAC proxy allows for bypassing a destination. Clarify known limitation around a system-level dynamic proxies that change bypassing answers mid-request. Fix networking unit tests by adding explicit proxy in DI. CI builds were picking up proxy setting from the host machine which prevented code paths related to our IP address filtering tests. * Fix spelling error in FabricCoreSetupTests comment (rquests -> requests) --------- Co-authored-by: Vinay Gera <[email protected]> * Sync skill references from GitHub-Copilot-for-Azure (#3901) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * Sync eng/common directory with azure-sdk-tools for PR 17165 (#3919) * Remove only the DevOps release work item update functionality --------- Co-authored-by: Jigyasa Chopra <[email protected]> Co-authored-by: Yun Liu <[email protected]> Co-authored-by: Copilot App <[email protected]> Co-authored-by: Hasan Abo-Shally <[email protected]> Co-authored-by: Amos Hersch <[email protected]> Co-authored-by: Amos Hersch <[email protected]> Co-authored-by: Steven Vukelich <[email protected]> Co-authored-by: Vinay Gera <[email protected]> Co-authored-by: ghcp4a-bot[bot] <288718659+ghcp4a-bot[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: azure-sdk-automation[bot] <191533747+azure-sdk-automation[bot]@users.noreply.github.com>
What does this PR do?
In namespace mode, the Azure Terraform export prompts in
e2eTestPrompts.mddid not select theaztfexporttools. The tools worked; the model did not pick them. The namespace description advertised "aztfexport command generation" without saying what aztfexport does, and several tools in the namespace competed for the same prompts.This PR keys each description on the signal that distinguishes its tool from its nearest competitor:
aztfexport resourceaztfexport resourcegroupazurerm getazurerm_prefix; states it reads reference docs rather than querying live resourcesazapi getMicrosoft.Storage/storageAccounts); same live-resource disclaimerconftest workspace/conftest plan.tfsource files from a generatedtfplan.jsonBehavior is unchanged. These tools still only generate commands for local execution and never execute an export or modify Azure resources.
Validation
Real model. Ran the checked-in Vally spec against
gpt-5.6-sol, the model named in the issue, through the namespace tool: 10/10 stimuli passed, including all three prompts reported as broken. Every run routed throughazmcp-azureterraform, the namespace path the issue says failed.ToolDescriptionEvaluator. Top-choice selection across the 30 azureterraform prompts went from 70.0% to 93.3%, with all prompts at 0.40 or above and in the top 3. The resource-ID prompt moved from rank 2 to rank 1.
Two prompts still miss on top-choice, both pre-existing and both for
azapi_get:Microsoft.Storage/storageAccountsloses tostorage_account_get, and one AzAPI prompt loses toazurerm_get. Both remain within the top 3 and above 0.40. Fixing them means editing tools outside this area, so they are left for a follow-up.Tests
AztfexportToolLoadingTests— namespace and all-tools discovery, routing, provider forwarding, installation help, HTTP-mode filteringAzureTerraformToolDescriptionTests— pins the disambiguating phrases so rewording cannot silently regress selectiontools/Azure.Mcp.Tools.AzureTerraform/tests/eval.yaml— checked-in Vally spec. The conftest prompts are markedcontext-requiredine2eTestPrompts.mdand are skipped by generated specs, so this file is their only Vally coverage.189/189 unit tests pass.
Notes for reviewers
azapi get. This is deliberate and measured: removing the duplication scored 90.0% instead of 93.3% and broke a passing prompt. Embeddings match on token overlap, so the repeated literals are doing retrieval work.GitHub issue number?
Fixes #3813
Pre-merge Checklist
servers/Azure.Mcp.Server/README.mdand/orservers/Fabric.Mcp.Server/README.mddocumentation — not applicable, the README does not list these tools individuallyREADME.mdchanges running the script./eng/scripts/Process-PackageReadMe.ps1— not applicable, no README changeToolDescriptionEvaluatorand obtained a score of0.4or more and a top 3 ranking for all related test promptsconsolidated-tools.json— not applicable, no tools added or renamedbreaking-changelabel — not applicable, no renamesservers/Azure.Mcp.Server/docs/azmcp-commands.md./eng/scripts/Update-AzCommandsMetadata.ps1to update tool metadata inazmcp-commands.md(required for CI) — produced no changes, as this PR edits only descriptive comments and not tool metadataservers/Azure.Mcp.Server/docs/e2eTestPrompts.md