I have an MCP server that uses nullable types for its parameters. For example:
[McpServerTool(Name = "get_data"), Description("Get data from the store")]
public async Task<IEnumerable<ResponseType>> GetData(
[Description("Number of records to return")] int? limit = null,
[Description("Start date")] DateTime? from = null,
When I use streamable HTTP (for example, via MCP Inspector), the data is sent as an empty string, like this:
"arguments":{ "limit": null, "from":"2025-01-01"}
When I compile this with ModelContextProtocol and ModelContextProtocol.AspNetCore version "0.1.0-preview.12", everything works as expected. However, if I use version "0.2.0-preview.3", I get the following Exception:
System.Text.Json.JsonException: The JSON value could not be converted to System.Nullable`1[System.DateTime]
How can I get this working?