← Back to Pull requests

[Samples] 04-PracticalImplementation: fix and verify all samples #1249

Open
unknown opened this pull request with 408 lines diff across 5 files
View on GitHub
unknown unknown commented on Nov 11, 2026 17:10 UTC
Author

Part 17 of 22 of the split of #1225, #1226 and #1227, which were too large to review. Each new PR changes only the files in its own folder, so none of them conflict, and together they make exactly the same changes as those three PRs.

Merge after: #1233 (01-first-server), because the Java Content Safety sample uses the 01-first-server Java server at /mcp. Merged earlier, this PR still applies cleanly; only those samples won't run until the other PR is in.

What was broken and how it was fixed

All five samples were run.

| Sample | What was broken | Fix / verification |
|---|---|---|
| TypeScript | Didn't build: zod 3.24 is below the SDK's ^3.25 peer, so the SDK installed its own zod 4 (TS2589). console.log wrote to stdout on a stdio server. build also started the server. openai was an unused dependency. | zod ^3.25.76 and a regenerated lockfile; logging to stderr; build = tsc; openai removed. Verified the tool (valid model and an unsupported model → isError) and the test://{query} template. |
| JavaScript | stdout logging crashed the client (Invalid JSON: Completion finished…). search://{query} was registered as a string, so it was a fixed resource and search://cats returned "not found". | stderr logging, ResourceTemplate, zod pin. Verified the tool and the template. |
| C# (Aspire) | net9.0, Aspire.AppHost.Sdk 9.3.1, ModelContextProtocol.AspNetCore 0.-, floating 9./1. package versions. The AppHost http profile refused to start without ASPIRE_ALLOW_UNSECURED_TRANSPORT. Divide by zero only returned a generic error. The README gave 5058 as the dashboard URL, passed the server URL to the Inspector as a command, and used the tool name NextFivePrimeNumbers. | net10.0, Aspire.AppHost.Sdk/13.6.4, MCP 2.4.0, all versions pinned. ASPIRE_ALLOW_UNSECURED_TRANSPORT=true in the http profile; McpException for divide by zero; README fixed. Ran dotnet watch run --project ./src/AppHost --launch-profile http; all 5 tools work over Streamable HTTP (Python client and Inspector CLI); divide by zero now says why. |
| Python | mcp.server.fastmcp import (gone in SDK 2.x). The client spawned python, which isn't always on PATH. | MCPServer, mcp dev server.py --with typer, sys.executable. All 5 client steps (tools, resources, prompt) pass. |
| Java (Content Safety) | Spring Boot 3.4.4, LangChain4j 1.0.0-beta3, the removed SSE client (HttpMcpTransport), conflicting Jackson/slf4j pins. | Spring Boot 4.1.2, langchain4j-bom 1.23.0, StreamableHttpMcpTransport to http://localhost:8080/mcp, ChatModel, isMicrosoftFoundry(true), azure-ai-contentsafety 1.1.1. Ran with the 01-first-server Java calculator, gpt-5.1 and Azure Content Safety: the web form and the CLI client call the MCP add and help tools, and the harmful prompt is blocked. |

The lesson README no longer describes the C# SDK as preview, and the pagination doc snippets use the Python 2.x API.

Testing

See the table. Not tested: the C# https profile (needs a trusted dev certificate), azd up, and the GitHub Copilot Chat steps. No changes to translations/ or translated_images/.

🤖 Generated with Claude Code

Diff: 408 lines (+306 / -102) across 5 files Reviewer: skytin1004 Review duration: 27342m
All Vouch review confidence checks passed
Residual risk 0.27 = Change Risk (0.50) × (1 − Review Confidence (0.47)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.50 · 408 lines diff across 5 files
0.50
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
0.02
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
46%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size diff_size
0.360
Shallow Review Depth shallow_review_depth
0.344
Ai Authored ai_authored
0.050
Real PR Conversation Timeline
1 comments
"Review active on #1249"
general weight: 0.35
Reviewers
Assignees
Unassigned
Labels
risk: low confidence: 46.7% reviewed
Vouch Risk Breakdown
AI-powered review risk analysis
Change Risk
Change Risk · Model 1 (XGBoost)
Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
Score: 49.8% (MEDIUM) · Higher = larger blast radius
49.8%
Review Confidence
Review Confidence · Models 2 & 3
Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
Score: 46.7% · Lower = rushed or shallow review
46.7%
Residual Risk
Residual Risk · Core Equation
Residual = Change × (1 − Confidence)
Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
Score: 26.6% · Safe to merge
26.6%