struct

Anthropic::ComputerUseTool

Inherits JSON::Serializable < Anthropic::ServerTool < JSON::Serializable < Struct < Value < Object

Computer use tool - allows Claude to interact with a computer desktop

An agent tool for controlling a computer through screenshots, mouse, and keyboard. Requires the computer use beta header.

message = client.messages.create(
  model: Anthropic::Model::CLAUDE_SONNET_4_6,
  max_tokens: 4096,
  server_tools: [Anthropic::ComputerUseTool.new(display_width_px: 1920, display_height_px: 1080)],
  messages: [{role: "user", content: "Open the browser and navigate to example.com"}]
)

Constructors

new(display_width_px : Int32, display_height_px : Int32, allowed_callers : Array(String) | Nil = nil, cache_control : CacheControl | Nil = nil, defer_loading : Bool | Nil = nil, display_number : Int32 | Nil = nil, enable_zoom : Bool | Nil = nil, input_examples : Array(JSON::Any) | Nil = nil, strict : Bool | Nil = nil)
Source
new(pull : JSON::PullParser)

Computer use tool - allows Claude to interact with a computer desktop

An agent tool for controlling a computer through screenshots, mouse, and keyboard. Requires the computer use beta header.

message = client.messages.create(
  model: Anthropic::Model::CLAUDE_SONNET_4_6,
  max_tokens: 4096,
  server_tools: [Anthropic::ComputerUseTool.new(display_width_px: 1920, display_height_px: 1080)],
  messages: [{role: "user", content: "Open the browser and navigate to example.com"}]
)
Source
new(*, __pull_for_json_serializable pull : JSON::PullParser)
Source

Instance methods

allowed_callers
Source
cache_control
Source
defer_loading
Source
display_height_px

Required: Height of the display in pixels

Source
display_number

Optional: Display number for multi-monitor setups

Source
display_width_px

Required: Width of the display in pixels

Source
enable_zoom

Optional: Enable zoom for accessibility

Source
input_examples
Source
name
Source
strict
Source
type
Source