Skip to content

Fix Part 7 README code snippets to match actual MyMcpServer template output#170

Merged
jongalloway merged 2 commits intomainfrom
copilot/fix-87d09b71-0cf1-42ac-94a1-ce1967ac5215
Oct 5, 2025
Merged

Fix Part 7 README code snippets to match actual MyMcpServer template output#170
jongalloway merged 2 commits intomainfrom
copilot/fix-87d09b71-0cf1-42ac-94a1-ce1967ac5215

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Oct 5, 2025

Summary

This PR fixes inconsistencies between the code snippets in Part 7 README and the actual MyMcpServer code, ensuring users can follow the instructions without encountering build errors.

Problem

After recent template updates, the Part 7 README contained code snippets that didn't match the actual generated code structure. Specifically:

  1. The RandomNumberTools.cs snippet was missing the namespace MyMcpServer.Tools; declaration
  2. The Program.cs snippet was missing the using MyMcpServer.Tools; import statement
  3. The narrative text incorrectly stated users would "replace" functionality instead of "add alongside"

Users following the README would encounter compilation errors when copying the snippets, leading to confusion and frustration.

Changes Made

Updated Part 7 - MCP Server Basics/README.md with minimal, surgical changes:

1. Added namespace declaration to RandomNumberTools.cs snippet (Step 3)

using System.ComponentModel;
using ModelContextProtocol.Server;

namespace MyMcpServer.Tools;  // <-- Added

/// <summary>
/// Sample MCP tools for demonstration purposes.

2. Added missing import to Program.cs snippet (Step 4)

using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using MyMcpServer.Tools;  // <-- Added

3. Updated narrative text for clarity

  • Changed "replace this with weather functionality" to "add weather functionality alongside this"
  • Fixed step numbering from "1." to "2." for proper sequence

Verification

  • ✅ All code snippets now match the actual MyMcpServer code files
  • ✅ Project builds successfully with no errors or warnings
  • ✅ MCP server runs and starts correctly
  • ✅ Validated user scenario - snippets can be copied and used directly without modification

Impact

Users following the Part 7 README will now:

  • Experience zero compilation errors when copying code snippets
  • See documentation that accurately reflects the template output
  • Understand the correct approach (adding tools alongside existing ones, not replacing)
  • Have confidence the instructions are accurate and complete

Resolves #87

Original prompt

This section details on the original issue you should resolve

<issue_title>Verify the code snippets and explanations in Part 7 match the code Part 7 / MyMcpServer</issue_title>
<issue_description>Verify that the code snippets are still accurate, since we have recently updated to a new version of the templates.</issue_description>

Comments on the Issue (you are @copilot in this section)

Fixes #169

💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

Co-authored-by: jongalloway <68539+jongalloway@users.noreply.github.com>
@jongalloway jongalloway requested a review from Copilot October 5, 2025 02:39
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

Updates code snippets and documentation in Part 7 README to match the actual MyMcpServer template output, ensuring users can follow the instructions without build errors.

  • Fixed missing namespace declaration in RandomNumberTools.cs snippet
  • Added missing using statement in Program.cs snippet
  • Corrected narrative text and step numbering for clarity

Copilot AI changed the title [WIP] Verify the code snippets and explanations in Part 7 match the code Part 7 / MyMcpServer Fix Part 7 README code snippets to match actual MyMcpServer template output Oct 5, 2025
Copilot AI requested a review from jongalloway October 5, 2025 02:42
@jongalloway jongalloway marked this pull request as ready for review October 5, 2025 03:10
@jongalloway jongalloway requested a review from Copilot October 5, 2025 03:10
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

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

@jongalloway jongalloway merged commit ca85a1e into main Oct 5, 2025
9 of 11 checks passed
@jongalloway jongalloway deleted the copilot/fix-87d09b71-0cf1-42ac-94a1-ce1967ac5215 branch October 5, 2025 03:11
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.

Verify the code snippets and explanations in Part 7 match the code Part 7 / MyMcpServer

3 participants