Class: Copilot::Tool

Inherits:
Struct
  • Object
show all
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

Instance Method Summary collapse

Instance Attribute Details

#descriptionObject

Returns the value of attribute description

Returns:

  • (Object)

    the current value of description



65
66
67
# File 'lib/copilot/types.rb', line 65

def description
  @description
end

#handlerObject

Returns the value of attribute handler

Returns:

  • (Object)

    the current value of handler



65
66
67
# File 'lib/copilot/types.rb', line 65

def handler
  @handler
end

#nameObject

Returns the value of attribute name

Returns:

  • (Object)

    the current value of name



65
66
67
# File 'lib/copilot/types.rb', line 65

def name
  @name
end

#parametersObject

Returns the value of attribute parameters

Returns:

  • (Object)

    the current value of parameters



65
66
67
# File 'lib/copilot/types.rb', line 65

def parameters
  @parameters
end

Instance Method Details

#to_wireHash

Returns wire-format representation sent to the server.

Returns:

  • (Hash)

    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