Describe the bug
Tool.InputSchema has a field initializer = McpJsonUtilities.DefaultMcpToolSchema that defaults to {"type":"object"}. When deserializing a JSON payload that omits inputSchema entirely, System.Text.Json leaves the field at its default rather than throwing. This silently accepts a spec-violating Tool definition.
Per the MCP spec (2025-03-26 through 2025-11-25), inputSchema is required on Tool ("required": ["inputSchema", "name"]). A missing inputSchema in JSON should cause deserialization to fail, not silently produce a valid-looking default.
To reproduce
string json = """{"name":"frob"}"""; // no inputSchema
Tool? tool = JsonSerializer.Deserialize<Tool>(json);
// Expected: throws (inputSchema is required per spec)
// Actual: succeeds, tool.InputSchema.ValueKind == Object, raw = {"type":"object"}
Expected behavior
Deserialization should fail when inputSchema is absent. Either add [JsonRequired] to the property, or validate in the setter that the value was explicitly provided.
Impact
Consumers using Tool for manifest deserialization cannot detect missing inputSchema after deserialization — the default masks the authoring error. This affects Windows MCP manifest validation (WMSS/ODR).
Version: ModelContextProtocol 0.4.0-preview.1
Describe the bug
Tool.InputSchemahas a field initializer= McpJsonUtilities.DefaultMcpToolSchemathat defaults to{"type":"object"}. When deserializing a JSON payload that omitsinputSchemaentirely, System.Text.Json leaves the field at its default rather than throwing. This silently accepts a spec-violating Tool definition.Per the MCP spec (2025-03-26 through 2025-11-25),
inputSchemais required on Tool ("required": ["inputSchema", "name"]). A missinginputSchemain JSON should cause deserialization to fail, not silently produce a valid-looking default.To reproduce
Expected behavior
Deserialization should fail when
inputSchemais absent. Either add[JsonRequired]to the property, or validate in the setter that the value was explicitly provided.Impact
Consumers using
Toolfor manifest deserialization cannot detect missinginputSchemaafter deserialization — the default masks the authoring error. This affects Windows MCP manifest validation (WMSS/ODR).Version: ModelContextProtocol 0.4.0-preview.1