Conversation
…e old constructor - Add new RequestContext(McpServer, JsonRpcRequest, TParams) constructor - Obsolete the old parameterless constructor - Change Params property from TParams? to TParams - Update all production code to use non-nullable Params - Update RequestHandlers.Set to use non-null TParams - Update InvokeHandlerAsync to use new constructor Co-authored-by: halter73 <54385+halter73@users.noreply.github.com> Agent-Logs-Url: https://github.com/modelcontextprotocol/csharp-sdk/sessions/a857ef9f-506e-4046-a2c2-d268cfc65701
Update all test files to use the new 3-arg RequestContext constructor (server, jsonRpcRequest, params) instead of the old 2-arg constructor with property initializer for Params. Changes: - Move Params from object initializer to constructor argument - Change .Params?. to .Params. on RequestContext variables - Fix request?.Params?.X to request?.Params.X - Remove dead null checks on non-nullable value type Level - Add required Name/Uri properties to default params instances Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: halter73 <54385+halter73@users.noreply.github.com> Agent-Logs-Url: https://github.com/modelcontextprotocol/csharp-sdk/sessions/a857ef9f-506e-4046-a2c2-d268cfc65701
When a client omits the "params" field from a JSON-RPC message, JsonSerializer.Deserialize returns null. Since RequestContext.Params is now non-nullable, we need to deserialize from an empty JSON object instead to get a valid default TParams instance. Co-authored-by: halter73 <54385+halter73@users.noreply.github.com> Agent-Logs-Url: https://github.com/modelcontextprotocol/csharp-sdk/sessions/1e9aed1a-2748-4117-987c-611e23751bea
…HandlerAsync constructor change The previous commits removed null-conditional operators (?.) from handler lambdas in McpServerImpl.cs, but at runtime TParams can still be null when JSON-RPC params is missing. Also reverts the EmptyJsonObject fallback in RequestHandlers.cs which failed for types with required constructor params. Restores defensive null-conditional access in all handler lambdas while keeping the desired API changes: TParams (non-nullable) InvokeHandlerAsync signature and the new 3-arg RequestContext constructor. Co-authored-by: halter73 <54385+halter73@users.noreply.github.com> Agent-Logs-Url: https://github.com/modelcontextprotocol/csharp-sdk/sessions/74aa9308-d4cf-4669-86b4-1a680d0676b4
…constructor - Rename the `@params` constructor parameter to `parameters` in the 3-arg RequestContext<TParams> constructor. - Add MCP9003 diagnostic ID to Obsoletions.cs for the obsolete 2-arg constructor, following the established pattern (Message, DiagnosticId, UrlFormat). - Update the [Obsolete] attribute to use the centralized constants with DiagnosticId and UrlFormat. - Document MCP9003 in docs/list-of-diagnostics.md. Co-authored-by: halter73 <54385+halter73@users.noreply.github.com> Agent-Logs-Url: https://github.com/modelcontextprotocol/csharp-sdk/sessions/6e17cd63-6cb0-4d77-ba6c-1f2a616fa03f
Copilot created this pull request from a session on behalf of
halter73
March 23, 2026 18:54
View session
…s returning CallToolResult (#1425) Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com> Co-authored-by: Stephen Toub <stoub@microsoft.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…1438) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Stephen Toub <stoub@microsoft.com>
Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…null-forgiving operator usage Co-authored-by: halter73 <54385+halter73@users.noreply.github.com> Agent-Logs-Url: https://github.com/modelcontextprotocol/csharp-sdk/sessions/43f266c7-392e-40c4-a808-759fb46d04d5
@params to parameters and add proper obsoletion for 2-arg RequestContext constructor…d-requestcontext-const # Conflicts: # tests/ModelContextProtocol.Tests/Server/McpServerToolTests.cs
stephentoub
reviewed
Mar 23, 2026
stephentoub
reviewed
Mar 26, 2026
src/ModelContextProtocol.Core/Server/AIFunctionMcpServerPrompt.cs
Outdated
Show resolved
Hide resolved
…in src/ Agent-Logs-Url: https://github.com/modelcontextprotocol/csharp-sdk/sessions/57676fa6-299c-40eb-ba0b-a7cbedbcef91 Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com>
halter73
approved these changes
Mar 26, 2026
…-conditionals) Agent-Logs-Url: https://github.com/modelcontextprotocol/csharp-sdk/sessions/e4a931bf-4543-4726-8897-54dcc66e354d Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com>
stephentoub
approved these changes
Mar 26, 2026
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.
RequestContextconstructor📱 Kick off Copilot coding agent tasks wherever you are with GitHub Mobile, available on iOS and Android.