Class: ClaudeSDK::ContentBlock::ToolUse

Inherits:
Object
  • Object
show all
Defined in:
lib/claude_sdk/types.rb

Overview

Tool use content block

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id:, name:, input:) ⇒ ToolUse

Returns a new instance of ToolUse.

Parameters:

  • id (String)

    unique identifier

  • name (String)

    tool name

  • input (Hash<String, Object>)

    tool input



150
151
152
153
154
# File 'lib/claude_sdk/types.rb', line 150

def initialize(id:, name:, input:)
  @id = id
  @name = name
  @input = input
end

Instance Attribute Details

#idObject

unique identifier for this tool use



144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
# File 'lib/claude_sdk/types.rb', line 144

class ToolUse
  attr_accessor :id, :name, :input

  # @param id [String] unique identifier
  # @param name [String] tool name
  # @param input [Hash<String, Object>] tool input
  def initialize(id:, name:, input:)
    @id = id
    @name = name
    @input = input
  end

  # @return [Hash] serialized representation
  def to_h
    { type: "tool_use", id: id, name: name, input: input }
  end
end

#inputObject

tool input parameters



144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
# File 'lib/claude_sdk/types.rb', line 144

class ToolUse
  attr_accessor :id, :name, :input

  # @param id [String] unique identifier
  # @param name [String] tool name
  # @param input [Hash<String, Object>] tool input
  def initialize(id:, name:, input:)
    @id = id
    @name = name
    @input = input
  end

  # @return [Hash] serialized representation
  def to_h
    { type: "tool_use", id: id, name: name, input: input }
  end
end

#nameObject

the tool name



144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
# File 'lib/claude_sdk/types.rb', line 144

class ToolUse
  attr_accessor :id, :name, :input

  # @param id [String] unique identifier
  # @param name [String] tool name
  # @param input [Hash<String, Object>] tool input
  def initialize(id:, name:, input:)
    @id = id
    @name = name
    @input = input
  end

  # @return [Hash] serialized representation
  def to_h
    { type: "tool_use", id: id, name: name, input: input }
  end
end

Instance Method Details

#to_hHash

Returns serialized representation.

Returns:

  • (Hash)

    serialized representation



157
158
159
# File 'lib/claude_sdk/types.rb', line 157

def to_h
  { type: "tool_use", id: id, name: name, input: input }
end