struct

Anthropic::ToolDefinition

Inherits JSON::Serializable < Struct < Value < Object

Tool definition for API requests

Represents a tool in the format expected by the Anthropic API.

definition = ToolDefinition.new(
  name: "get_weather",
  description: "Get weather for a location",
  input_schema: InputSchema.build(
    properties: {"location" => Schema.string("City name")},
    required: ["location"]
  )
)

Constructors

new(name : String, description : String, input_schema : InputSchema, type : String | Nil = nil, strict : Bool | Nil = nil, cache_control : CacheControl | Nil = nil, allowed_callers : Array(String) | Nil = nil, defer_loading : Bool | Nil = nil, input_examples : Array(JSON::Any) | Nil = nil, eager_input_streaming : Bool | Nil = nil)
Source
new(*, __pull_for_json_serializable pull : JSON::PullParser)
Source

Instance methods

allowed_callers
Source
cache_control
Source
defer_loading?
Source
description
Source
eager_input_streaming
Source
input_examples
Source
input_schema
Source
name
Source
strict
Source
type
Source