inputSchema interface requires type key

When defining a tool without any arguments taken, it should be allowed
to not have to define the `input_schema` at all, and the default value
for such a scenario should be `{ type: "object" }` as per the schema.

16d91abb68/schema/2025-06-18/schema.ts (L896-L900)
This commit is contained in:
Piotr Usewicz 2025-07-30 18:29:01 +02:00
commit 2508defc79
No known key found for this signature in database

View file

@ -79,6 +79,21 @@ module MCP
InputSchema.new(properties: { foo: { :$ref => "#/definitions/bar" } }, required: [:foo])
end
end
test "== compares two input schemas with the same properties and required fields" do
schema1 = InputSchema.new(properties: { foo: { type: "string" } }, required: [:foo])
schema2 = InputSchema.new(properties: { foo: { type: "string" } }, required: [:foo])
assert_equal schema1, schema2
schema3 = InputSchema.new(properties: { bar: { type: "string" } }, required: [:bar])
refute_equal schema1, schema3
schema4 = InputSchema.new(properties: { foo: { type: "string" } }, required: [:bar])
refute_equal schema1, schema4
schema5 = InputSchema.new(properties: { bar: { type: "string" } }, required: [:foo])
refute_equal schema1, schema5
end
end
end
end