[MCP] Fixed issue with deserialization of prompt settings#9085
Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes a deserialization issue with MCP prompt settings when using polymorphic types. The fix enables proper handling of JSON where the type discriminator property (type) appears after other properties in the JSON object, which is a known limitation in System.Text.Json's polymorphic deserialization.
Changes:
- Added
AllowOutOfOrderMetadataProperties = truetoMcpSettingsSerializerContextto support out-of-order discriminator properties in polymorphic JSON deserialization - Created new test project
Adapters.Mcp.Core.Testswith a test validating the fix for polymorphic message content deserialization - Updated solution files to include the new test project
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| McpSettingsSerializerContext.cs | Added AllowOutOfOrderMetadataProperties = true option to fix polymorphic deserialization when discriminator appears after data properties |
| McpPromptSettingsSerializerTests.cs | New test file validating that prompt settings with polymorphic content can be deserialized when the type discriminator appears after other properties |
| HotChocolate.Adapters.Mcp.Core.Tests.csproj | New test project configuration file following the standard patterns used in the codebase |
| Adapters.slnx | Updated solution file to include new test project |
| All.slnx | Updated master solution file to include new test project |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
🚀 Fusion Gateway Performance ResultsSimple Composite QueryConstant Load (50 VUs)
📊 Response Time Metrics
Ramping Load (0→50→500→50 VUs)
📊 Response Time Metrics
Executed Query fragment User on User {
id
username
name
}
fragment Review on Review {
id
body
}
fragment Product on Product {
inStock
name
price
shippingEstimate
upc
weight
}
query TestQuery {
topProducts(first: 5) {
...Product
reviews {
...Review
author {
...User
}
}
}
}Deep Recursion QueryConstant Load (50 VUs)
📊 Response Time Metrics
Ramping Load (0→50→500→50 VUs)
📊 Response Time Metrics
Executed Query fragment User on User {
id
username
name
}
fragment Review on Review {
id
body
}
fragment Product on Product {
inStock
name
price
shippingEstimate
upc
weight
}
query TestQuery {
users {
...User
reviews {
...Review
product {
...Product
reviews {
...Review
author {
...User
reviews {
...Review
product {
...Product
}
}
}
}
}
}
}
topProducts(first: 5) {
...Product
reviews {
...Review
author {
...User
reviews {
...Review
product {
...Product
}
}
}
}
}
}Variable Batching ThroughputConstant Load (50 VUs)
📊 Response Time Metrics
Ramping Load (0→50→500→50 VUs)
📊 Response Time Metrics
Executed Query query TestQuery_8f7a46ce_2(
$__fusion_1_upc: ID!
$__fusion_2_price: Long!
$__fusion_2_weight: Long!
) {
productByUpc(upc: $__fusion_1_upc) {
inStock
shippingEstimate(weight: $__fusion_2_weight, price: $__fusion_2_price)
}
}Variables (5 sets batched in single request) [
{ "__fusion_1_upc": "1", "__fusion_2_price": 899, "__fusion_2_weight": 100 },
{ "__fusion_1_upc": "2", "__fusion_2_price": 1299, "__fusion_2_weight": 1000 },
{ "__fusion_1_upc": "3", "__fusion_2_price": 15, "__fusion_2_weight": 20 },
{ "__fusion_1_upc": "4", "__fusion_2_price": 499, "__fusion_2_weight": 100 },
{ "__fusion_1_upc": "5", "__fusion_2_price": 1299, "__fusion_2_weight": 1000 }
]No baseline data available for comparison. Run 21624270459 • Commit cea6215 • Tue, 03 Feb 2026 09:35:11 GMT |
Summary of the changes (Less than 80 chars)