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