Class: Copilot::Tool
- Inherits:
-
Struct
- Object
- Struct
- Copilot::Tool
- Defined in:
- lib/copilot/types.rb
Overview
A tool definition. handler is a callable (Proc/lambda/method) that receives (arguments, invocation) and returns a result (String, Hash, or ToolResult).
Instance Attribute Summary collapse
-
#description ⇒ Object
Returns the value of attribute description.
-
#handler ⇒ Object
Returns the value of attribute handler.
-
#name ⇒ Object
Returns the value of attribute name.
-
#parameters ⇒ Object
Returns the value of attribute parameters.
Instance Method Summary collapse
-
#to_wire ⇒ Hash
Wire-format representation sent to the server.
Instance Attribute Details
#description ⇒ Object
Returns the value of attribute description
65 66 67 |
# File 'lib/copilot/types.rb', line 65 def description @description end |
#handler ⇒ Object
Returns the value of attribute handler
65 66 67 |
# File 'lib/copilot/types.rb', line 65 def handler @handler end |
#name ⇒ Object
Returns the value of attribute name
65 66 67 |
# File 'lib/copilot/types.rb', line 65 def name @name end |
#parameters ⇒ Object
Returns the value of attribute parameters
65 66 67 |
# File 'lib/copilot/types.rb', line 65 def parameters @parameters end |
Instance Method Details
#to_wire ⇒ Hash
Returns wire-format representation sent to the server.
70 71 72 73 74 75 |
# File 'lib/copilot/types.rb', line 70 def to_wire h = { name: name } h[:description] = description if description h[:parameters] = parameters if parameters h end |