Repository navigation
fix(eng): keep tool catalog stderr out of prompt validation JSON - #3854
Merged
Merged
Conversation
Read the tool catalog only from stdout while leaving stderr diagnostics visible. Add focused native-process Pester coverage for valid, malformed, and contaminated stdout without changing exit-code handling. Adapted the engineering fix and regression tests from Hasan Abo-Shally's #3701 (commit 0c8bc64). No Fabric tool implementation is included. Co-authored-by: Hasan Abo-Shally <[email protected]> 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. |
Amos Hersch (AmosHersch)
requested review from
a team,
JasonYeMSFT (JasonYeMSFT),
Larry Osterman (LarryOsterman),
Rick Winter (RickWinter),
Chidozie Ononiwu (chidozieononiwu),
Connie Yau (conniey),
msalaman and
Steven Vukelich (vukelich)
and removed request for
a team
October 5, 2026 20:11
This was referenced Oct 5, 2026
Amos Hersch (AmosHersch)
marked this pull request as ready for review
October 6, 2026 07:32
Contributor
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The focused implementation matches its documented contract and has comprehensive regression coverage.
Review effort: Balanced
Findings: None
What changed in this PR
Separates tool-catalog stderr diagnostics from stdout JSON parsing, preventing native startup logs from breaking prompt validation.
Changes:
- Parse only stdout while keeping stderr visible.
- Add five focused Pester regression tests.
- Document the stream-handling contract.
| File | Description |
|---|---|
eng/scripts/Test-ToolSelectionPrompts.ps1 |
Separates stderr from catalog JSON. |
eng/scripts/Test-ToolSelectionPrompts.Tests.ps1 |
Tests valid and malformed stream scenarios. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
KupoCat
approved these changes
Oct 6, 2026
Amos Hersch (AmosHersch)
deleted the
amoshersch-tool-catalog-stream-fix
branch
October 6, 2026 08:33
14 of 21 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Extracts the bottom engineering prerequisite for the planned Fabric tool PR stack, so the existing tool drafts can depend on one shared fix instead of carrying duplicate changes to
eng/scripts/Test-ToolSelectionPrompts.ps1.The prompt validator currently merges native startup diagnostics from stderr into the JSON returned by
tools list --name-only. This removes only that stream merge: stdout is still parsed verbatim, stderr remains visible, and the existing exit-code, empty-output, and JSON-error handling stays unchanged. Script help documents this contract.Adds five focused Pester cases covering clean stdout, valid stdout plus visible stderr, malformed stdout, valid JSON on stderr with invalid stdout, and rejection of non-JSON stdout prefixes rather than manufacturing a catalog. The tests execute the production capture/parsing statements with a real child PowerShell process, without building or invoking Azure/Fabric resources.
Source attribution: adapted the narrow engineering fix and regression tests from Hasan Abo-Shally's #3701, specifically commit
0c8bc64a3bf5e80928bbcb9b904a9aa777acba21. Original-author and Copilot co-author trailers are preserved in this PR's single commit. The Get Item implementation and the author's fork branch are not included or modified.No tools are added or changed. No other validators, runtime/authentication code, dependencies, project files, provisioning, existing tool PR refs, or native stack metadata are changed. Main was rechecked at
d4df988aae3ba1de008efe10f664f12817bdcc24; searches found no separate equivalent engineering PR before publication.GitHub issue number?
N/A — engineering prerequisite extracted for the approved Fabric draft reorganization. Related prior art: #3701.
Pre-merge Checklist
servers/Azure.Mcp.Server/README.mdand/orservers/Fabric.Mcp.Server/README.mddocumentationREADME.mdchanges running the script./eng/scripts/Process-PackageReadMe.ps1. See Package READMEToolDescriptionEvaluatorand obtained a score of0.4or more and a top 3 ranking for all related test promptsconsolidated-tools.jsonbreaking-changelabelservers/Azure.Mcp.Server/docs/azmcp-commands.md./eng/scripts/Update-AzCommandsMetadata.ps1to update tool metadata inazmcp-commands.md(required for CI)servers/Azure.Mcp.Server/docs/e2eTestPrompts.mdcrypto mining, spam, data exfiltration, etc.)/azp run mcp - pullrequest - liveto run Live Test PipelineThe release changelog and MCP-tool-specific checklist items are not applicable to this internal engineering-validation-only change. No product release behavior, tool descriptions, or live resource operations change.
Validation
PowerShell 7.6.6, isolated Pester 5.7.1, and the existing .NET SDK 10.0.401; no
global.jsonor machine-wide tool configuration changes.Invoke-Pester -Path .\eng\scripts\Test-ToolSelectionPrompts.Tests.ps1 -Output Detailed -CI— passed, 5/5. Before the production fix, the same suite passed 4/5 and failed specifically on valid stdout plus stderr with aConvertFrom-Jsonerror.Test-ToolSelectionPrompts.ps1 -SkipServerBuildexecution against a local native stub, using isolated prompt/build metadata — 7/7 scenarios passed. In addition to the stream cases, empty stdout remained a skip/failure, and native exit 7 retained its warning/skip path without attempting JSON parsing. This is script-level fixture evidence, not a full server test; the original generated build metadata was restored afterward.dotnet build .\servers\Fabric.Mcp.Server\src\Fabric.Mcp.Server.csproj --no-restore --nologo --verbosity quiet— passed, 0 warnings and 0 errors after the normal build script restored existing dependencies. The first no-restore attempt reported the expected missingproject.assets.jsonin the fresh worktree..\eng\scripts\Build-Local.ps1 -ServerName Fabric.Mcp.Server -VerifyNpx— not fully passed. The real trimmed Fabric publish and local npm packaging succeeded, but the existingclear-npx-cachehelper failed becausenpm config get cachereports that the cache option is protected. No cache-helper, npm, or configuration workaround is included in this PR.npx -y '.\.work\packages_npm\Fabric.Mcp.Server\wrapper\microsoft-fabric-mcp-1.5.0-alpha.12345.tgz' tools list --name-only— passed independently, returning status 200 and 48 tool names while retaining the real startup stderr diagnostic. Used a session-local npm cache and disabled telemetry; no Fabric resource commands were invoked..\eng\common\spelling\Invoke-Cspell.ps1 -FileList @('.\eng\scripts\Test-ToolSelectionPrompts.ps1', '.\eng\scripts\Test-ToolSelectionPrompts.Tests.ps1')with a session-local-PackageInstallCache— passed, 2 files checked, 0 issues.git diff --check— passed.Broader Azure builds, full solution tests, ToolDescriptionEvaluator, live Fabric/Azure calls, deployments, and credential changes were not performed. Hosted CI and owner review remain outstanding.
Ownership
Both changed files match
/eng/in CODEOWNERS:microsoft/azure-mcp,microsoft/azure-sdk-eng, andmicrosoft/fabric-mcp. This draft is intentionally independently reviewable by Azure MCP/EngSys before the Fabric foundation and tool layers are stacked above it.Invoking Livetests
Copilot submitted PRs are not trustworthy by default. Users with
writeaccess 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.