anthropic 1.15.2 → 1.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (153) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +13 -0
  3. data/README.md +10 -10
  4. data/lib/anthropic/helpers/tools/compaction_control.rb +105 -0
  5. data/lib/anthropic/helpers/tools/runner.rb +126 -13
  6. data/lib/anthropic/models/anthropic_beta.rb +3 -0
  7. data/lib/anthropic/models/beta/beta_code_execution_tool_20250522.rb +28 -1
  8. data/lib/anthropic/models/beta/beta_code_execution_tool_20250825.rb +28 -1
  9. data/lib/anthropic/models/beta/beta_content_block.rb +3 -1
  10. data/lib/anthropic/models/beta/beta_content_block_param.rb +3 -1
  11. data/lib/anthropic/models/beta/beta_direct_caller.rb +21 -0
  12. data/lib/anthropic/models/beta/beta_mcp_tool_config.rb +27 -0
  13. data/lib/anthropic/models/beta/beta_mcp_tool_default_config.rb +27 -0
  14. data/lib/anthropic/models/beta/beta_mcp_toolset.rb +58 -0
  15. data/lib/anthropic/models/beta/beta_memory_tool_20250818.rb +36 -1
  16. data/lib/anthropic/models/beta/beta_message.rb +2 -2
  17. data/lib/anthropic/models/beta/beta_message_param.rb +3 -3
  18. data/lib/anthropic/models/beta/beta_output_config.rb +34 -0
  19. data/lib/anthropic/models/beta/beta_raw_content_block_start_event.rb +5 -3
  20. data/lib/anthropic/models/beta/beta_server_tool_caller.rb +27 -0
  21. data/lib/anthropic/models/beta/beta_server_tool_use_block.rb +32 -1
  22. data/lib/anthropic/models/beta/beta_server_tool_use_block_param.rb +33 -1
  23. data/lib/anthropic/models/beta/beta_tool.rb +36 -1
  24. data/lib/anthropic/models/beta/beta_tool_bash_20241022.rb +36 -1
  25. data/lib/anthropic/models/beta/beta_tool_bash_20250124.rb +36 -1
  26. data/lib/anthropic/models/beta/beta_tool_computer_use_20241022.rb +36 -1
  27. data/lib/anthropic/models/beta/beta_tool_computer_use_20250124.rb +36 -1
  28. data/lib/anthropic/models/beta/beta_tool_computer_use_20251124.rb +114 -0
  29. data/lib/anthropic/models/beta/beta_tool_reference_block.rb +25 -0
  30. data/lib/anthropic/models/beta/beta_tool_reference_block_param.rb +36 -0
  31. data/lib/anthropic/models/beta/beta_tool_result_block_param.rb +8 -4
  32. data/lib/anthropic/models/beta/beta_tool_search_tool_bm25_20251119.rb +85 -0
  33. data/lib/anthropic/models/beta/beta_tool_search_tool_regex_20251119.rb +85 -0
  34. data/lib/anthropic/models/beta/beta_tool_search_tool_result_block.rb +43 -0
  35. data/lib/anthropic/models/beta/beta_tool_search_tool_result_block_param.rb +53 -0
  36. data/lib/anthropic/models/beta/beta_tool_search_tool_result_error.rb +44 -0
  37. data/lib/anthropic/models/beta/beta_tool_search_tool_result_error_param.rb +38 -0
  38. data/lib/anthropic/models/beta/beta_tool_search_tool_search_result_block.rb +26 -0
  39. data/lib/anthropic/models/beta/beta_tool_search_tool_search_result_block_param.rb +26 -0
  40. data/lib/anthropic/models/beta/beta_tool_text_editor_20241022.rb +36 -1
  41. data/lib/anthropic/models/beta/beta_tool_text_editor_20250124.rb +36 -1
  42. data/lib/anthropic/models/beta/beta_tool_text_editor_20250429.rb +36 -1
  43. data/lib/anthropic/models/beta/beta_tool_text_editor_20250728.rb +36 -1
  44. data/lib/anthropic/models/beta/beta_tool_union.rb +17 -1
  45. data/lib/anthropic/models/beta/beta_tool_use_block.rb +30 -1
  46. data/lib/anthropic/models/beta/beta_tool_use_block_param.rb +27 -1
  47. data/lib/anthropic/models/beta/beta_web_fetch_tool_20250910.rb +28 -1
  48. data/lib/anthropic/models/beta/beta_web_search_tool_20250305.rb +28 -1
  49. data/lib/anthropic/models/beta/message_count_tokens_params.rb +29 -4
  50. data/lib/anthropic/models/beta/message_create_params.rb +12 -3
  51. data/lib/anthropic/models/beta/messages/batch_create_params.rb +16 -7
  52. data/lib/anthropic/models/messages/batch_create_params.rb +4 -4
  53. data/lib/anthropic/models/model.rb +10 -0
  54. data/lib/anthropic/resources/beta/messages.rb +26 -11
  55. data/lib/anthropic/resources/messages.rb +8 -2
  56. data/lib/anthropic/version.rb +1 -1
  57. data/lib/anthropic.rb +19 -0
  58. data/manifest.yaml +1 -0
  59. data/rbi/anthropic/models/anthropic_beta.rbi +2 -0
  60. data/rbi/anthropic/models/beta/beta_code_execution_tool_20250522.rbi +77 -0
  61. data/rbi/anthropic/models/beta/beta_code_execution_tool_20250825.rbi +77 -0
  62. data/rbi/anthropic/models/beta/beta_content_block.rbi +1 -0
  63. data/rbi/anthropic/models/beta/beta_content_block_param.rbi +1 -0
  64. data/rbi/anthropic/models/beta/beta_direct_caller.rbi +31 -0
  65. data/rbi/anthropic/models/beta/beta_mcp_tool_config.rbi +46 -0
  66. data/rbi/anthropic/models/beta/beta_mcp_tool_default_config.rbi +46 -0
  67. data/rbi/anthropic/models/beta/beta_mcp_toolset.rbi +100 -0
  68. data/rbi/anthropic/models/beta/beta_memory_tool_20250818.rbi +88 -0
  69. data/rbi/anthropic/models/beta/beta_message.rbi +1 -0
  70. data/rbi/anthropic/models/beta/beta_output_config.rbi +82 -0
  71. data/rbi/anthropic/models/beta/beta_raw_content_block_start_event.rbi +2 -0
  72. data/rbi/anthropic/models/beta/beta_server_tool_caller.rbi +34 -0
  73. data/rbi/anthropic/models/beta/beta_server_tool_use_block.rbi +54 -1
  74. data/rbi/anthropic/models/beta/beta_server_tool_use_block_param.rbi +70 -1
  75. data/rbi/anthropic/models/beta/beta_tool.rbi +75 -0
  76. data/rbi/anthropic/models/beta/beta_tool_bash_20241022.rbi +88 -0
  77. data/rbi/anthropic/models/beta/beta_tool_bash_20250124.rbi +88 -0
  78. data/rbi/anthropic/models/beta/beta_tool_computer_use_20241022.rbi +88 -0
  79. data/rbi/anthropic/models/beta/beta_tool_computer_use_20250124.rbi +88 -0
  80. data/rbi/anthropic/models/beta/beta_tool_computer_use_20251124.rbi +204 -0
  81. data/rbi/anthropic/models/beta/beta_tool_reference_block.rbi +35 -0
  82. data/rbi/anthropic/models/beta/beta_tool_reference_block_param.rbi +67 -0
  83. data/rbi/anthropic/models/beta/beta_tool_result_block_param.rbi +3 -1
  84. data/rbi/anthropic/models/beta/beta_tool_search_tool_bm25_20251119.rbi +198 -0
  85. data/rbi/anthropic/models/beta/beta_tool_search_tool_regex_20251119.rbi +198 -0
  86. data/rbi/anthropic/models/beta/beta_tool_search_tool_result_block.rbi +81 -0
  87. data/rbi/anthropic/models/beta/beta_tool_search_tool_result_block_param.rbi +110 -0
  88. data/rbi/anthropic/models/beta/beta_tool_search_tool_result_error.rbi +104 -0
  89. data/rbi/anthropic/models/beta/beta_tool_search_tool_result_error_param.rbi +96 -0
  90. data/rbi/anthropic/models/beta/beta_tool_search_tool_search_result_block.rbi +48 -0
  91. data/rbi/anthropic/models/beta/beta_tool_search_tool_search_result_block_param.rbi +48 -0
  92. data/rbi/anthropic/models/beta/beta_tool_text_editor_20241022.rbi +88 -0
  93. data/rbi/anthropic/models/beta/beta_tool_text_editor_20250124.rbi +88 -0
  94. data/rbi/anthropic/models/beta/beta_tool_text_editor_20250429.rbi +88 -0
  95. data/rbi/anthropic/models/beta/beta_tool_text_editor_20250728.rbi +88 -0
  96. data/rbi/anthropic/models/beta/beta_tool_union.rbi +9 -1
  97. data/rbi/anthropic/models/beta/beta_tool_use_block.rbi +55 -2
  98. data/rbi/anthropic/models/beta/beta_tool_use_block_param.rbi +58 -1
  99. data/rbi/anthropic/models/beta/beta_web_fetch_tool_20250910.rbi +77 -0
  100. data/rbi/anthropic/models/beta/beta_web_search_tool_20250305.rbi +77 -0
  101. data/rbi/anthropic/models/beta/message_count_tokens_params.rbi +44 -5
  102. data/rbi/anthropic/models/beta/message_create_params.rbi +35 -4
  103. data/rbi/anthropic/models/beta/messages/batch_create_params.rbi +43 -10
  104. data/rbi/anthropic/models/messages/batch_create_params.rbi +6 -6
  105. data/rbi/anthropic/models/model.rbi +8 -0
  106. data/rbi/anthropic/resources/beta/messages.rbi +29 -3
  107. data/sig/anthropic/models/anthropic_beta.rbs +2 -0
  108. data/sig/anthropic/models/beta/beta_code_execution_tool_20250522.rbs +27 -0
  109. data/sig/anthropic/models/beta/beta_code_execution_tool_20250825.rbs +27 -0
  110. data/sig/anthropic/models/beta/beta_content_block.rbs +1 -0
  111. data/sig/anthropic/models/beta/beta_content_block_param.rbs +1 -0
  112. data/sig/anthropic/models/beta/beta_direct_caller.rbs +17 -0
  113. data/sig/anthropic/models/beta/beta_mcp_tool_config.rbs +23 -0
  114. data/sig/anthropic/models/beta/beta_mcp_tool_default_config.rbs +23 -0
  115. data/sig/anthropic/models/beta/beta_mcp_toolset.rbs +48 -0
  116. data/sig/anthropic/models/beta/beta_memory_tool_20250818.rbs +36 -0
  117. data/sig/anthropic/models/beta/beta_output_config.rbs +34 -0
  118. data/sig/anthropic/models/beta/beta_raw_content_block_start_event.rbs +1 -0
  119. data/sig/anthropic/models/beta/beta_server_tool_caller.rbs +23 -0
  120. data/sig/anthropic/models/beta/beta_server_tool_use_block.rbs +19 -0
  121. data/sig/anthropic/models/beta/beta_server_tool_use_block_param.rbs +25 -2
  122. data/sig/anthropic/models/beta/beta_tool.rbs +36 -0
  123. data/sig/anthropic/models/beta/beta_tool_bash_20241022.rbs +36 -0
  124. data/sig/anthropic/models/beta/beta_tool_bash_20250124.rbs +36 -0
  125. data/sig/anthropic/models/beta/beta_tool_computer_use_20241022.rbs +36 -0
  126. data/sig/anthropic/models/beta/beta_tool_computer_use_20250124.rbs +36 -0
  127. data/sig/anthropic/models/beta/beta_tool_computer_use_20251124.rbs +99 -0
  128. data/sig/anthropic/models/beta/beta_tool_reference_block.rbs +20 -0
  129. data/sig/anthropic/models/beta/beta_tool_reference_block_param.rbs +34 -0
  130. data/sig/anthropic/models/beta/beta_tool_result_block_param.rbs +1 -0
  131. data/sig/anthropic/models/beta/beta_tool_search_tool_bm25_20251119.rbs +79 -0
  132. data/sig/anthropic/models/beta/beta_tool_search_tool_regex_20251119.rbs +79 -0
  133. data/sig/anthropic/models/beta/beta_tool_search_tool_result_block.rbs +44 -0
  134. data/sig/anthropic/models/beta/beta_tool_search_tool_result_block_param.rbs +49 -0
  135. data/sig/anthropic/models/beta/beta_tool_search_tool_result_error.rbs +51 -0
  136. data/sig/anthropic/models/beta/beta_tool_search_tool_result_error_param.rbs +46 -0
  137. data/sig/anthropic/models/beta/beta_tool_search_tool_search_result_block.rbs +29 -0
  138. data/sig/anthropic/models/beta/beta_tool_search_tool_search_result_block_param.rbs +29 -0
  139. data/sig/anthropic/models/beta/beta_tool_text_editor_20241022.rbs +36 -0
  140. data/sig/anthropic/models/beta/beta_tool_text_editor_20250124.rbs +36 -0
  141. data/sig/anthropic/models/beta/beta_tool_text_editor_20250429.rbs +36 -0
  142. data/sig/anthropic/models/beta/beta_tool_text_editor_20250728.rbs +36 -0
  143. data/sig/anthropic/models/beta/beta_tool_union.rbs +4 -0
  144. data/sig/anthropic/models/beta/beta_tool_use_block.rbs +21 -2
  145. data/sig/anthropic/models/beta/beta_tool_use_block_param.rbs +21 -2
  146. data/sig/anthropic/models/beta/beta_web_fetch_tool_20250910.rbs +27 -0
  147. data/sig/anthropic/models/beta/beta_web_search_tool_20250305.rbs +27 -0
  148. data/sig/anthropic/models/beta/message_count_tokens_params.rbs +13 -0
  149. data/sig/anthropic/models/beta/message_create_params.rbs +9 -0
  150. data/sig/anthropic/models/beta/messages/batch_create_params.rbs +9 -0
  151. data/sig/anthropic/models/model.rbs +9 -1
  152. data/sig/anthropic/resources/beta/messages.rbs +3 -0
  153. metadata +54 -2
@@ -23,6 +23,27 @@ module Anthropic
23
23
  sig { returns(Symbol) }
24
24
  attr_accessor :type
25
25
 
26
+ sig do
27
+ returns(
28
+ T.nilable(
29
+ T::Array[
30
+ Anthropic::Beta::BetaCodeExecutionTool20250522::AllowedCaller::OrSymbol
31
+ ]
32
+ )
33
+ )
34
+ end
35
+ attr_reader :allowed_callers
36
+
37
+ sig do
38
+ params(
39
+ allowed_callers:
40
+ T::Array[
41
+ Anthropic::Beta::BetaCodeExecutionTool20250522::AllowedCaller::OrSymbol
42
+ ]
43
+ ).void
44
+ end
45
+ attr_writer :allowed_callers
46
+
26
47
  # Create a cache control breakpoint at this content block.
27
48
  sig { returns(T.nilable(Anthropic::Beta::BetaCacheControlEphemeral)) }
28
49
  attr_reader :cache_control
@@ -35,6 +56,14 @@ module Anthropic
35
56
  end
36
57
  attr_writer :cache_control
37
58
 
59
+ # If true, tool will not be included in initial system prompt. Only loaded when
60
+ # returned via tool_reference from tool search.
61
+ sig { returns(T.nilable(T::Boolean)) }
62
+ attr_reader :defer_loading
63
+
64
+ sig { params(defer_loading: T::Boolean).void }
65
+ attr_writer :defer_loading
66
+
38
67
  sig { returns(T.nilable(T::Boolean)) }
39
68
  attr_reader :strict
40
69
 
@@ -43,16 +72,25 @@ module Anthropic
43
72
 
44
73
  sig do
45
74
  params(
75
+ allowed_callers:
76
+ T::Array[
77
+ Anthropic::Beta::BetaCodeExecutionTool20250522::AllowedCaller::OrSymbol
78
+ ],
46
79
  cache_control:
47
80
  T.nilable(Anthropic::Beta::BetaCacheControlEphemeral::OrHash),
81
+ defer_loading: T::Boolean,
48
82
  strict: T::Boolean,
49
83
  name: Symbol,
50
84
  type: Symbol
51
85
  ).returns(T.attached_class)
52
86
  end
53
87
  def self.new(
88
+ allowed_callers: nil,
54
89
  # Create a cache control breakpoint at this content block.
55
90
  cache_control: nil,
91
+ # If true, tool will not be included in initial system prompt. Only loaded when
92
+ # returned via tool_reference from tool search.
93
+ defer_loading: nil,
56
94
  strict: nil,
57
95
  # Name of the tool.
58
96
  #
@@ -67,14 +105,53 @@ module Anthropic
67
105
  {
68
106
  name: Symbol,
69
107
  type: Symbol,
108
+ allowed_callers:
109
+ T::Array[
110
+ Anthropic::Beta::BetaCodeExecutionTool20250522::AllowedCaller::OrSymbol
111
+ ],
70
112
  cache_control:
71
113
  T.nilable(Anthropic::Beta::BetaCacheControlEphemeral),
114
+ defer_loading: T::Boolean,
72
115
  strict: T::Boolean
73
116
  }
74
117
  )
75
118
  end
76
119
  def to_hash
77
120
  end
121
+
122
+ module AllowedCaller
123
+ extend Anthropic::Internal::Type::Enum
124
+
125
+ TaggedSymbol =
126
+ T.type_alias do
127
+ T.all(
128
+ Symbol,
129
+ Anthropic::Beta::BetaCodeExecutionTool20250522::AllowedCaller
130
+ )
131
+ end
132
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
133
+
134
+ DIRECT =
135
+ T.let(
136
+ :direct,
137
+ Anthropic::Beta::BetaCodeExecutionTool20250522::AllowedCaller::TaggedSymbol
138
+ )
139
+ CODE_EXECUTION_20250825 =
140
+ T.let(
141
+ :code_execution_20250825,
142
+ Anthropic::Beta::BetaCodeExecutionTool20250522::AllowedCaller::TaggedSymbol
143
+ )
144
+
145
+ sig do
146
+ override.returns(
147
+ T::Array[
148
+ Anthropic::Beta::BetaCodeExecutionTool20250522::AllowedCaller::TaggedSymbol
149
+ ]
150
+ )
151
+ end
152
+ def self.values
153
+ end
154
+ end
78
155
  end
79
156
  end
80
157
  end
@@ -23,6 +23,27 @@ module Anthropic
23
23
  sig { returns(Symbol) }
24
24
  attr_accessor :type
25
25
 
26
+ sig do
27
+ returns(
28
+ T.nilable(
29
+ T::Array[
30
+ Anthropic::Beta::BetaCodeExecutionTool20250825::AllowedCaller::OrSymbol
31
+ ]
32
+ )
33
+ )
34
+ end
35
+ attr_reader :allowed_callers
36
+
37
+ sig do
38
+ params(
39
+ allowed_callers:
40
+ T::Array[
41
+ Anthropic::Beta::BetaCodeExecutionTool20250825::AllowedCaller::OrSymbol
42
+ ]
43
+ ).void
44
+ end
45
+ attr_writer :allowed_callers
46
+
26
47
  # Create a cache control breakpoint at this content block.
27
48
  sig { returns(T.nilable(Anthropic::Beta::BetaCacheControlEphemeral)) }
28
49
  attr_reader :cache_control
@@ -35,6 +56,14 @@ module Anthropic
35
56
  end
36
57
  attr_writer :cache_control
37
58
 
59
+ # If true, tool will not be included in initial system prompt. Only loaded when
60
+ # returned via tool_reference from tool search.
61
+ sig { returns(T.nilable(T::Boolean)) }
62
+ attr_reader :defer_loading
63
+
64
+ sig { params(defer_loading: T::Boolean).void }
65
+ attr_writer :defer_loading
66
+
38
67
  sig { returns(T.nilable(T::Boolean)) }
39
68
  attr_reader :strict
40
69
 
@@ -43,16 +72,25 @@ module Anthropic
43
72
 
44
73
  sig do
45
74
  params(
75
+ allowed_callers:
76
+ T::Array[
77
+ Anthropic::Beta::BetaCodeExecutionTool20250825::AllowedCaller::OrSymbol
78
+ ],
46
79
  cache_control:
47
80
  T.nilable(Anthropic::Beta::BetaCacheControlEphemeral::OrHash),
81
+ defer_loading: T::Boolean,
48
82
  strict: T::Boolean,
49
83
  name: Symbol,
50
84
  type: Symbol
51
85
  ).returns(T.attached_class)
52
86
  end
53
87
  def self.new(
88
+ allowed_callers: nil,
54
89
  # Create a cache control breakpoint at this content block.
55
90
  cache_control: nil,
91
+ # If true, tool will not be included in initial system prompt. Only loaded when
92
+ # returned via tool_reference from tool search.
93
+ defer_loading: nil,
56
94
  strict: nil,
57
95
  # Name of the tool.
58
96
  #
@@ -67,14 +105,53 @@ module Anthropic
67
105
  {
68
106
  name: Symbol,
69
107
  type: Symbol,
108
+ allowed_callers:
109
+ T::Array[
110
+ Anthropic::Beta::BetaCodeExecutionTool20250825::AllowedCaller::OrSymbol
111
+ ],
70
112
  cache_control:
71
113
  T.nilable(Anthropic::Beta::BetaCacheControlEphemeral),
114
+ defer_loading: T::Boolean,
72
115
  strict: T::Boolean
73
116
  }
74
117
  )
75
118
  end
76
119
  def to_hash
77
120
  end
121
+
122
+ module AllowedCaller
123
+ extend Anthropic::Internal::Type::Enum
124
+
125
+ TaggedSymbol =
126
+ T.type_alias do
127
+ T.all(
128
+ Symbol,
129
+ Anthropic::Beta::BetaCodeExecutionTool20250825::AllowedCaller
130
+ )
131
+ end
132
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
133
+
134
+ DIRECT =
135
+ T.let(
136
+ :direct,
137
+ Anthropic::Beta::BetaCodeExecutionTool20250825::AllowedCaller::TaggedSymbol
138
+ )
139
+ CODE_EXECUTION_20250825 =
140
+ T.let(
141
+ :code_execution_20250825,
142
+ Anthropic::Beta::BetaCodeExecutionTool20250825::AllowedCaller::TaggedSymbol
143
+ )
144
+
145
+ sig do
146
+ override.returns(
147
+ T::Array[
148
+ Anthropic::Beta::BetaCodeExecutionTool20250825::AllowedCaller::TaggedSymbol
149
+ ]
150
+ )
151
+ end
152
+ def self.values
153
+ end
154
+ end
78
155
  end
79
156
  end
80
157
  end
@@ -22,6 +22,7 @@ module Anthropic
22
22
  Anthropic::Beta::BetaCodeExecutionToolResultBlock,
23
23
  Anthropic::Beta::BetaBashCodeExecutionToolResultBlock,
24
24
  Anthropic::Beta::BetaTextEditorCodeExecutionToolResultBlock,
25
+ Anthropic::Beta::BetaToolSearchToolResultBlock,
25
26
  Anthropic::Beta::BetaMCPToolUseBlock,
26
27
  Anthropic::Beta::BetaMCPToolResultBlock,
27
28
  Anthropic::Beta::BetaContainerUploadBlock
@@ -26,6 +26,7 @@ module Anthropic
26
26
  Anthropic::Beta::BetaCodeExecutionToolResultBlockParam,
27
27
  Anthropic::Beta::BetaBashCodeExecutionToolResultBlockParam,
28
28
  Anthropic::Beta::BetaTextEditorCodeExecutionToolResultBlockParam,
29
+ Anthropic::Beta::BetaToolSearchToolResultBlockParam,
29
30
  Anthropic::Beta::BetaMCPToolUseBlockParam,
30
31
  Anthropic::Beta::BetaRequestMCPToolResultBlockParam,
31
32
  Anthropic::Beta::BetaContainerUploadBlockParam
@@ -0,0 +1,31 @@
1
+ # typed: strong
2
+
3
+ module Anthropic
4
+ module Models
5
+ BetaDirectCaller = Beta::BetaDirectCaller
6
+
7
+ module Beta
8
+ class BetaDirectCaller < Anthropic::Internal::Type::BaseModel
9
+ OrHash =
10
+ T.type_alias do
11
+ T.any(
12
+ Anthropic::Beta::BetaDirectCaller,
13
+ Anthropic::Internal::AnyHash
14
+ )
15
+ end
16
+
17
+ sig { returns(Symbol) }
18
+ attr_accessor :type
19
+
20
+ # Tool invocation directly from the model.
21
+ sig { params(type: Symbol).returns(T.attached_class) }
22
+ def self.new(type: :direct)
23
+ end
24
+
25
+ sig { override.returns({ type: Symbol }) }
26
+ def to_hash
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,46 @@
1
+ # typed: strong
2
+
3
+ module Anthropic
4
+ module Models
5
+ BetaMCPToolConfig = Beta::BetaMCPToolConfig
6
+
7
+ module Beta
8
+ class BetaMCPToolConfig < Anthropic::Internal::Type::BaseModel
9
+ OrHash =
10
+ T.type_alias do
11
+ T.any(
12
+ Anthropic::Beta::BetaMCPToolConfig,
13
+ Anthropic::Internal::AnyHash
14
+ )
15
+ end
16
+
17
+ sig { returns(T.nilable(T::Boolean)) }
18
+ attr_reader :defer_loading
19
+
20
+ sig { params(defer_loading: T::Boolean).void }
21
+ attr_writer :defer_loading
22
+
23
+ sig { returns(T.nilable(T::Boolean)) }
24
+ attr_reader :enabled
25
+
26
+ sig { params(enabled: T::Boolean).void }
27
+ attr_writer :enabled
28
+
29
+ # Configuration for a specific tool in an MCP toolset.
30
+ sig do
31
+ params(defer_loading: T::Boolean, enabled: T::Boolean).returns(
32
+ T.attached_class
33
+ )
34
+ end
35
+ def self.new(defer_loading: nil, enabled: nil)
36
+ end
37
+
38
+ sig do
39
+ override.returns({ defer_loading: T::Boolean, enabled: T::Boolean })
40
+ end
41
+ def to_hash
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,46 @@
1
+ # typed: strong
2
+
3
+ module Anthropic
4
+ module Models
5
+ BetaMCPToolDefaultConfig = Beta::BetaMCPToolDefaultConfig
6
+
7
+ module Beta
8
+ class BetaMCPToolDefaultConfig < Anthropic::Internal::Type::BaseModel
9
+ OrHash =
10
+ T.type_alias do
11
+ T.any(
12
+ Anthropic::Beta::BetaMCPToolDefaultConfig,
13
+ Anthropic::Internal::AnyHash
14
+ )
15
+ end
16
+
17
+ sig { returns(T.nilable(T::Boolean)) }
18
+ attr_reader :defer_loading
19
+
20
+ sig { params(defer_loading: T::Boolean).void }
21
+ attr_writer :defer_loading
22
+
23
+ sig { returns(T.nilable(T::Boolean)) }
24
+ attr_reader :enabled
25
+
26
+ sig { params(enabled: T::Boolean).void }
27
+ attr_writer :enabled
28
+
29
+ # Default configuration for tools in an MCP toolset.
30
+ sig do
31
+ params(defer_loading: T::Boolean, enabled: T::Boolean).returns(
32
+ T.attached_class
33
+ )
34
+ end
35
+ def self.new(defer_loading: nil, enabled: nil)
36
+ end
37
+
38
+ sig do
39
+ override.returns({ defer_loading: T::Boolean, enabled: T::Boolean })
40
+ end
41
+ def to_hash
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,100 @@
1
+ # typed: strong
2
+
3
+ module Anthropic
4
+ module Models
5
+ BetaMCPToolset = Beta::BetaMCPToolset
6
+
7
+ module Beta
8
+ class BetaMCPToolset < Anthropic::Internal::Type::BaseModel
9
+ OrHash =
10
+ T.type_alias do
11
+ T.any(Anthropic::Beta::BetaMCPToolset, Anthropic::Internal::AnyHash)
12
+ end
13
+
14
+ # Name of the MCP server to configure tools for
15
+ sig { returns(String) }
16
+ attr_accessor :mcp_server_name
17
+
18
+ sig { returns(Symbol) }
19
+ attr_accessor :type
20
+
21
+ # Create a cache control breakpoint at this content block.
22
+ sig { returns(T.nilable(Anthropic::Beta::BetaCacheControlEphemeral)) }
23
+ attr_reader :cache_control
24
+
25
+ sig do
26
+ params(
27
+ cache_control:
28
+ T.nilable(Anthropic::Beta::BetaCacheControlEphemeral::OrHash)
29
+ ).void
30
+ end
31
+ attr_writer :cache_control
32
+
33
+ # Configuration overrides for specific tools, keyed by tool name
34
+ sig do
35
+ returns(
36
+ T.nilable(T::Hash[Symbol, Anthropic::Beta::BetaMCPToolConfig])
37
+ )
38
+ end
39
+ attr_accessor :configs
40
+
41
+ # Default configuration applied to all tools from this server
42
+ sig { returns(T.nilable(Anthropic::Beta::BetaMCPToolDefaultConfig)) }
43
+ attr_reader :default_config
44
+
45
+ sig do
46
+ params(
47
+ default_config: Anthropic::Beta::BetaMCPToolDefaultConfig::OrHash
48
+ ).void
49
+ end
50
+ attr_writer :default_config
51
+
52
+ # Configuration for a group of tools from an MCP server.
53
+ #
54
+ # Allows configuring enabled status and defer_loading for all tools from an MCP
55
+ # server, with optional per-tool overrides.
56
+ sig do
57
+ params(
58
+ mcp_server_name: String,
59
+ cache_control:
60
+ T.nilable(Anthropic::Beta::BetaCacheControlEphemeral::OrHash),
61
+ configs:
62
+ T.nilable(
63
+ T::Hash[Symbol, Anthropic::Beta::BetaMCPToolConfig::OrHash]
64
+ ),
65
+ default_config: Anthropic::Beta::BetaMCPToolDefaultConfig::OrHash,
66
+ type: Symbol
67
+ ).returns(T.attached_class)
68
+ end
69
+ def self.new(
70
+ # Name of the MCP server to configure tools for
71
+ mcp_server_name:,
72
+ # Create a cache control breakpoint at this content block.
73
+ cache_control: nil,
74
+ # Configuration overrides for specific tools, keyed by tool name
75
+ configs: nil,
76
+ # Default configuration applied to all tools from this server
77
+ default_config: nil,
78
+ type: :mcp_toolset
79
+ )
80
+ end
81
+
82
+ sig do
83
+ override.returns(
84
+ {
85
+ mcp_server_name: String,
86
+ type: Symbol,
87
+ cache_control:
88
+ T.nilable(Anthropic::Beta::BetaCacheControlEphemeral),
89
+ configs:
90
+ T.nilable(T::Hash[Symbol, Anthropic::Beta::BetaMCPToolConfig]),
91
+ default_config: Anthropic::Beta::BetaMCPToolDefaultConfig
92
+ }
93
+ )
94
+ end
95
+ def to_hash
96
+ end
97
+ end
98
+ end
99
+ end
100
+ end
@@ -23,6 +23,27 @@ module Anthropic
23
23
  sig { returns(Symbol) }
24
24
  attr_accessor :type
25
25
 
26
+ sig do
27
+ returns(
28
+ T.nilable(
29
+ T::Array[
30
+ Anthropic::Beta::BetaMemoryTool20250818::AllowedCaller::OrSymbol
31
+ ]
32
+ )
33
+ )
34
+ end
35
+ attr_reader :allowed_callers
36
+
37
+ sig do
38
+ params(
39
+ allowed_callers:
40
+ T::Array[
41
+ Anthropic::Beta::BetaMemoryTool20250818::AllowedCaller::OrSymbol
42
+ ]
43
+ ).void
44
+ end
45
+ attr_writer :allowed_callers
46
+
26
47
  # Create a cache control breakpoint at this content block.
27
48
  sig { returns(T.nilable(Anthropic::Beta::BetaCacheControlEphemeral)) }
28
49
  attr_reader :cache_control
@@ -35,6 +56,22 @@ module Anthropic
35
56
  end
36
57
  attr_writer :cache_control
37
58
 
59
+ # If true, tool will not be included in initial system prompt. Only loaded when
60
+ # returned via tool_reference from tool search.
61
+ sig { returns(T.nilable(T::Boolean)) }
62
+ attr_reader :defer_loading
63
+
64
+ sig { params(defer_loading: T::Boolean).void }
65
+ attr_writer :defer_loading
66
+
67
+ sig { returns(T.nilable(T::Array[T::Hash[Symbol, T.anything]])) }
68
+ attr_reader :input_examples
69
+
70
+ sig do
71
+ params(input_examples: T::Array[T::Hash[Symbol, T.anything]]).void
72
+ end
73
+ attr_writer :input_examples
74
+
38
75
  sig { returns(T.nilable(T::Boolean)) }
39
76
  attr_reader :strict
40
77
 
@@ -43,16 +80,27 @@ module Anthropic
43
80
 
44
81
  sig do
45
82
  params(
83
+ allowed_callers:
84
+ T::Array[
85
+ Anthropic::Beta::BetaMemoryTool20250818::AllowedCaller::OrSymbol
86
+ ],
46
87
  cache_control:
47
88
  T.nilable(Anthropic::Beta::BetaCacheControlEphemeral::OrHash),
89
+ defer_loading: T::Boolean,
90
+ input_examples: T::Array[T::Hash[Symbol, T.anything]],
48
91
  strict: T::Boolean,
49
92
  name: Symbol,
50
93
  type: Symbol
51
94
  ).returns(T.attached_class)
52
95
  end
53
96
  def self.new(
97
+ allowed_callers: nil,
54
98
  # Create a cache control breakpoint at this content block.
55
99
  cache_control: nil,
100
+ # If true, tool will not be included in initial system prompt. Only loaded when
101
+ # returned via tool_reference from tool search.
102
+ defer_loading: nil,
103
+ input_examples: nil,
56
104
  strict: nil,
57
105
  # Name of the tool.
58
106
  #
@@ -67,14 +115,54 @@ module Anthropic
67
115
  {
68
116
  name: Symbol,
69
117
  type: Symbol,
118
+ allowed_callers:
119
+ T::Array[
120
+ Anthropic::Beta::BetaMemoryTool20250818::AllowedCaller::OrSymbol
121
+ ],
70
122
  cache_control:
71
123
  T.nilable(Anthropic::Beta::BetaCacheControlEphemeral),
124
+ defer_loading: T::Boolean,
125
+ input_examples: T::Array[T::Hash[Symbol, T.anything]],
72
126
  strict: T::Boolean
73
127
  }
74
128
  )
75
129
  end
76
130
  def to_hash
77
131
  end
132
+
133
+ module AllowedCaller
134
+ extend Anthropic::Internal::Type::Enum
135
+
136
+ TaggedSymbol =
137
+ T.type_alias do
138
+ T.all(
139
+ Symbol,
140
+ Anthropic::Beta::BetaMemoryTool20250818::AllowedCaller
141
+ )
142
+ end
143
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
144
+
145
+ DIRECT =
146
+ T.let(
147
+ :direct,
148
+ Anthropic::Beta::BetaMemoryTool20250818::AllowedCaller::TaggedSymbol
149
+ )
150
+ CODE_EXECUTION_20250825 =
151
+ T.let(
152
+ :code_execution_20250825,
153
+ Anthropic::Beta::BetaMemoryTool20250818::AllowedCaller::TaggedSymbol
154
+ )
155
+
156
+ sig do
157
+ override.returns(
158
+ T::Array[
159
+ Anthropic::Beta::BetaMemoryTool20250818::AllowedCaller::TaggedSymbol
160
+ ]
161
+ )
162
+ end
163
+ def self.values
164
+ end
165
+ end
78
166
  end
79
167
  end
80
168
  end
@@ -167,6 +167,7 @@ module Anthropic
167
167
  Anthropic::Beta::BetaCodeExecutionToolResultBlock::OrHash,
168
168
  Anthropic::Beta::BetaBashCodeExecutionToolResultBlock::OrHash,
169
169
  Anthropic::Beta::BetaTextEditorCodeExecutionToolResultBlock::OrHash,
170
+ Anthropic::Beta::BetaToolSearchToolResultBlock::OrHash,
170
171
  Anthropic::Beta::BetaMCPToolUseBlock::OrHash,
171
172
  Anthropic::Beta::BetaMCPToolResultBlock::OrHash,
172
173
  Anthropic::Beta::BetaContainerUploadBlock::OrHash