Class: MCP::Tool::Schema
- Inherits:
-
Object
- Object
- MCP::Tool::Schema
- Defined in:
- lib/mcp/tool/schema.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#schema ⇒ Object
readonly
Returns the value of attribute schema.
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(schema = {}) ⇒ Schema
constructor
A new instance of Schema.
- #to_h ⇒ Object
Constructor Details
#initialize(schema = {}) ⇒ Schema
Returns a new instance of Schema.
10 11 12 13 14 |
# File 'lib/mcp/tool/schema.rb', line 10 def initialize(schema = {}) @schema = deep_transform_keys(JSON.parse(JSON.dump(schema)), &:to_sym) @schema[:type] ||= "object" validate_schema! end |
Instance Attribute Details
#schema ⇒ Object (readonly)
Returns the value of attribute schema.
8 9 10 |
# File 'lib/mcp/tool/schema.rb', line 8 def schema @schema end |
Instance Method Details
#==(other) ⇒ Object
16 17 18 |
# File 'lib/mcp/tool/schema.rb', line 16 def ==(other) other.is_a?(self.class) && schema == other.schema end |
#to_h ⇒ Object
20 21 22 |
# File 'lib/mcp/tool/schema.rb', line 20 def to_h @schema end |