-
Notifications
You must be signed in to change notification settings - Fork 5
Implement IOptionsFormatter on McpOptions for improved serviceability #111
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
Conversation
Co-authored-by: mathewc <[email protected]>
|
@copilot Please address the PR comments I've made up to this point |
mathewc
left a comment
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.
Please address the requested changes
|
@copilot act on the feedback provided. |
| [EditorBrowsable(EditorBrowsableState.Never)] | ||
| string IOptionsFormatter.Format() | ||
| { | ||
| JObject options = new JObject |
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.
Use System.Text.Json rather than Newtonsoft
| { | ||
| { nameof(ServerName), ServerName }, | ||
| { nameof(ServerVersion), ServerVersion }, | ||
| { nameof(Instructions), Instructions }, |
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.
Let's omit Instructions, since this may contain customer sensitive info
|
|
||
| Assert.NotNull(formatted); | ||
|
|
||
| var json = JObject.Parse(formatted); |
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.
Also do an assertion on the number of properties to make the test stronger
|
|
||
| var json = JObject.Parse(formatted); | ||
|
|
||
| Assert.Contains(nameof(options.ServerName), json.Properties().Select(p => p.Name)); |
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.
Same here - do an assertion on the number of properties logged
mathewc
left a comment
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.
Please fix
mathewc
left a comment
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.
mathewc
left a comment
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.
@copilot See the comments I left and please address
|
This pull request has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 7 days. It will be closed if no further activity occurs within 7 days of this comment. |
Summary
This PR implements the
IOptionsFormatterinterface on theMcpOptionsclass, following the pattern established by other Azure WebJobs SDK extensions (e.g., HttpOptions) to improve serviceability and diagnostics.Changes
McpOptions.cs
IOptionsFormatterinterfaceFormat()method that returns a formatted JSON string containing configuration valuesServerNameServerVersionInstructionsEncryptClientStateMessageOptions.UseAbsoluteUriForEndpointTesting
McpOptionsTests.csto verify the Format() implementationFormat_ReturnsExpectedJson()validates correct JSON output with custom valuesFormat_IncludesAllNonSensitiveProperties()ensures all expected properties are presentBenefits
This implementation allows the Azure Functions runtime to log configuration values for diagnostic purposes, making it easier to troubleshoot configuration-related issues in production environments. The formatted output follows the same pattern as other extensions, providing a consistent experience across the WebJobs SDK ecosystem.
Fixes #<issue_number>
Original prompt
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.