Class: Igniter::Extensions::Contracts::Mcp::ToolArgument
- Inherits:
-
Object
- Object
- Igniter::Extensions::Contracts::Mcp::ToolArgument
- Defined in:
- lib/igniter/extensions/contracts/mcp/tool_argument.rb
Instance Attribute Summary collapse
-
#default ⇒ Object
readonly
Returns the value of attribute default.
-
#enum ⇒ Object
readonly
Returns the value of attribute enum.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#required ⇒ Object
readonly
Returns the value of attribute required.
-
#summary ⇒ Object
readonly
Returns the value of attribute summary.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(name:, type:, summary:, required: false, default: nil, enum: nil) ⇒ ToolArgument
constructor
A new instance of ToolArgument.
- #to_h ⇒ Object
Constructor Details
#initialize(name:, type:, summary:, required: false, default: nil, enum: nil) ⇒ ToolArgument
Returns a new instance of ToolArgument.
10 11 12 13 14 15 16 17 18 |
# File 'lib/igniter/extensions/contracts/mcp/tool_argument.rb', line 10 def initialize(name:, type:, summary:, required: false, default: nil, enum: nil) @name = name.to_sym @type = type.to_sym @summary = summary @required = required == true @default = default @enum = Array(enum).map(&:to_sym).freeze freeze end |
Instance Attribute Details
#default ⇒ Object (readonly)
Returns the value of attribute default.
8 9 10 |
# File 'lib/igniter/extensions/contracts/mcp/tool_argument.rb', line 8 def default @default end |
#enum ⇒ Object (readonly)
Returns the value of attribute enum.
8 9 10 |
# File 'lib/igniter/extensions/contracts/mcp/tool_argument.rb', line 8 def enum @enum end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
8 9 10 |
# File 'lib/igniter/extensions/contracts/mcp/tool_argument.rb', line 8 def name @name end |
#required ⇒ Object (readonly)
Returns the value of attribute required.
8 9 10 |
# File 'lib/igniter/extensions/contracts/mcp/tool_argument.rb', line 8 def required @required end |
#summary ⇒ Object (readonly)
Returns the value of attribute summary.
8 9 10 |
# File 'lib/igniter/extensions/contracts/mcp/tool_argument.rb', line 8 def summary @summary end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
8 9 10 |
# File 'lib/igniter/extensions/contracts/mcp/tool_argument.rb', line 8 def type @type end |
Instance Method Details
#to_h ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/igniter/extensions/contracts/mcp/tool_argument.rb', line 20 def to_h payload = { name: name, type: type, summary: summary, required: required } payload[:default] = default unless default.nil? payload[:enum] = enum unless enum.empty? payload end |