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

@ -15,8 +15,13 @@ module MCP
validate_schema!
end
def ==(other)
other.is_a?(InputSchema) && properties == other.properties && required == other.required
end
def to_h
{ type: "object", properties: }.tap do |hsh|
{ type: "object" }.tap do |hsh|
hsh[:properties] = properties if properties.any?
hsh[:required] = required if required.any?
end
end