- add support for resource templates - improve capability negotiation on handlers - clean up readme - reduce default protocol version to "2024-11-05" - address spec compliance of resources - add debug gem to development - alias ModelContextProtocol to MCP - move prompt subclasses to subdir - improve tool and prompt definition - improve passing of server context to tools - improve tool input schema validation
26 lines
588 B
Ruby
26 lines
588 B
Ruby
# frozen_string_literal: true
|
|
|
|
module ModelContextProtocol
|
|
class Tool
|
|
class InputSchema
|
|
attr_reader :properties, :required
|
|
|
|
def initialize(properties: {}, required: [])
|
|
@properties = properties
|
|
@required = required.map(&:to_sym)
|
|
end
|
|
|
|
def to_h
|
|
{ type: "object", properties:, required: }
|
|
end
|
|
|
|
def missing_required_arguments?(arguments)
|
|
missing_required_arguments(arguments).any?
|
|
end
|
|
|
|
def missing_required_arguments(arguments)
|
|
(required - arguments.keys.map(&:to_sym))
|
|
end
|
|
end
|
|
end
|
|
end
|