Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Exception raised when a nullable parameter is sent as an empty string in the Http request #601

Copy link
Copy link

Description

@aschabus
Issue body actions

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?

Reactions are currently unavailable

Metadata

Metadata

Labels

bugSomething isn't workingSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

Morty Proxy This is a proxified and sanitized view of the page, visit original site.