I haven't been able to figure out how to make a tool property "optional", in the sense that the invocation doesn't expect it and it gets populated by a default value.
My code looks something like the following, where, in a context outside of MCP, MyMcpTool runs correctly without supplying optionalInt:
public async Task<List<string>> MyMcpTool(
[McpToolTrigger("my tool", "my description)] ToolInvocationContext context,
[McpToolProperty("my optional property", "integer", "description")] int? optionalInt)
{
if(optionalInt.HasValue) ...
else ...
...
}
when I try to invoke the function without specifying an int for the property, I get an error. And, in tools like Postman's MCP inspector, this tool method is being reported as having a required integer parameter. How can I make it optional so that the MCP server doesn't complain when it's not provided and it doesn't show up as a required parameter in tool inspectors?