-
Notifications
You must be signed in to change notification settings - Fork 0
Implement XML Documentation Generator for Tool Methods (In Progress) #101
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement XML Documentation Generator for Tool Methods (In Progress) #101
Conversation
…teList Co-authored-by: jongalloway <68539+jongalloway@users.noreply.github.com>
…l pattern Co-authored-by: jongalloway <68539+jongalloway@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds XML documentation file generation infrastructure to prepare for future use of the MCP SDK's source generator feature. The PR correctly identifies a blocking SDK limitation where the source generator doesn't preserve optional parameter default values, which would break backward compatibility for all 54 async tool methods. The infrastructure is put in place now so it can be enabled when the SDK addresses this limitation.
Key changes:
- Enable XML documentation file generation in the project configuration
- Suppress CS1591 warnings globally to avoid noise from non-tool helper classes
- Document the intent to use source generator in the future (though this comment needs clarification)
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
@copilot Summarize the limitations I hit in this pull request due to the C# MCP SDK XML Source Generator. I think there were issues with both optional parameters and async method signatures. |
During investigation, I found two key limitations with the MCP SDK v0.4.1-preview.1 XML Source Generator: 1. Optional Parameters Lose Default ValuesWhen using partial methods, the source generator creates declarations without preserving default parameter values: // Original method signature
public async Task<string> DotnetProjectBuild(
string? project = null, // Has default
bool machineReadable = false) // Has default
// After partial conversion - defaults are lost
public partial Task<string> DotnetProjectBuild(
string? project, // Now required
bool machineReadable) // Now requiredThis broke all tests that relied on calling methods with optional parameters like 2. Async Methods Cannot Use
|
|
@copilot This is no longer blocked as it has been fixed in the new release of the C# MCP SDK (v0.5.0-preview.1) which has now been implemented in this project. |
Understood. I'll now implement the XML Documentation Generator conversion for the tool methods using v0.5.0-preview.1 which has fixed the optional parameter and async method issues. I'll proceed with the incremental conversion approach outlined in the original issue. |
Co-authored-by: jongalloway <68539+jongalloway@users.noreply.github.com>
Co-authored-by: jongalloway <68539+jongalloway@users.noreply.github.com>
Co-authored-by: jongalloway <68539+jongalloway@users.noreply.github.com>
There was a problem hiding this 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 2 out of 2 changed files in this pull request and generated 2 comments.
|
@copilot Are there more methods that should be updated to use XML Documentation as part of this pull request? |
Yes, there are 50 more methods that should be converted to use XML Documentation. I've converted 12 out of 62 total methods so far (19%). The remaining methods follow the same pattern and can be converted incrementally. All converted methods are working correctly with optional parameters preserved and all tests passing. |
…more - 32 total) Co-authored-by: jongalloway <68539+jongalloway@users.noreply.github.com>
Co-authored-by: jongalloway <68539+jongalloway@users.noreply.github.com>
There was a problem hiding this 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 2 changed files in this pull request and generated no new comments.
…CP server tool methods
The MCP C# SDK v0.5.0-preview.1 has fixed the blocking limitations that previously prevented implementation of the XML Documentation Generator. This PR implements the conversion from manual
[Description]attributes to XML documentation comments for tool methods.Status: In Progress (33/62 methods converted - 53%)
SDK v0.5.0-preview.1 has resolved the issues with optional parameters and async methods that blocked this feature in v0.4.1-preview.1.
Changes Made
DotNetCliToolsclasspartialto enable source generatorVerified Working
✅ Optional parameter defaults ARE preserved in SDK v0.5.0-preview.1
✅ Async methods work correctly without manual workarounds
✅ All 300 tests passing
✅ Description attributes generated correctly from XML
<summary>tags✅ Parameter descriptions generated correctly from XML
<param>tagsPattern
Methods are converted from:
To:
The source generator automatically creates the
[Description]attributes from the XML documentation.Remaining Work
29 methods remaining to convert:
The conversion is straightforward and can be completed incrementally using the established pattern.
Original prompt
This section details on the original issue you should resolve
<issue_title>Implement XML Documentation Generator for Tool Methods</issue_title>
<issue_description>## Overview
The MCP C# SDK v0.4.1-preview.1 includes a production-ready source generator that automatically creates
[Description]attributes from XML documentation comments. This feature would reduce maintenance burden and improve IDE experience by using a single source of truth for documentation.Current State
Our codebase has:
[Description]attributes across all tool methods and parametersBenefits
How It Works
The source generator (introduced in #899) automatically generates
[Description]attributes from XML comments for partial methods tagged with MCP attributes.Pattern
Before (Current):
After (With XML Generator):
The source generator automatically creates:
Requirements
public sealed partial class DotNetCliTools/// <summary>,/// <param>,/// <returns><GenerateDocumentationFile>true</GenerateDocumentationFile>to projectImplementation Approach
Phase 1: Setup
DotNetCliToolsclass aspartialPhase 2: Incremental Conversion
Convert methods incrementally by category to minimize risk:
Phase 3: Verification
Risks & Considerations
Risks
Mitigations
Example Conversion
Current Code:
Converted Code:
Success Criteria
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.