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
@@ -0,0 +1,44 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Anthropic
4
+ module Models
5
+ module Beta
6
+ class BetaToolSearchToolResultError < Anthropic::Internal::Type::BaseModel
7
+ # @!attribute error_code
8
+ #
9
+ # @return [Symbol, Anthropic::Models::Beta::BetaToolSearchToolResultError::ErrorCode]
10
+ required :error_code, enum: -> { Anthropic::Beta::BetaToolSearchToolResultError::ErrorCode }
11
+
12
+ # @!attribute error_message
13
+ #
14
+ # @return [String, nil]
15
+ required :error_message, String, nil?: true
16
+
17
+ # @!attribute type
18
+ #
19
+ # @return [Symbol, :tool_search_tool_result_error]
20
+ required :type, const: :tool_search_tool_result_error
21
+
22
+ # @!method initialize(error_code:, error_message:, type: :tool_search_tool_result_error)
23
+ # @param error_code [Symbol, Anthropic::Models::Beta::BetaToolSearchToolResultError::ErrorCode]
24
+ # @param error_message [String, nil]
25
+ # @param type [Symbol, :tool_search_tool_result_error]
26
+
27
+ # @see Anthropic::Models::Beta::BetaToolSearchToolResultError#error_code
28
+ module ErrorCode
29
+ extend Anthropic::Internal::Type::Enum
30
+
31
+ INVALID_TOOL_INPUT = :invalid_tool_input
32
+ UNAVAILABLE = :unavailable
33
+ TOO_MANY_REQUESTS = :too_many_requests
34
+ EXECUTION_TIME_EXCEEDED = :execution_time_exceeded
35
+
36
+ # @!method self.values
37
+ # @return [Array<Symbol>]
38
+ end
39
+ end
40
+ end
41
+
42
+ BetaToolSearchToolResultError = Beta::BetaToolSearchToolResultError
43
+ end
44
+ end
@@ -0,0 +1,38 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Anthropic
4
+ module Models
5
+ module Beta
6
+ class BetaToolSearchToolResultErrorParam < Anthropic::Internal::Type::BaseModel
7
+ # @!attribute error_code
8
+ #
9
+ # @return [Symbol, Anthropic::Models::Beta::BetaToolSearchToolResultErrorParam::ErrorCode]
10
+ required :error_code, enum: -> { Anthropic::Beta::BetaToolSearchToolResultErrorParam::ErrorCode }
11
+
12
+ # @!attribute type
13
+ #
14
+ # @return [Symbol, :tool_search_tool_result_error]
15
+ required :type, const: :tool_search_tool_result_error
16
+
17
+ # @!method initialize(error_code:, type: :tool_search_tool_result_error)
18
+ # @param error_code [Symbol, Anthropic::Models::Beta::BetaToolSearchToolResultErrorParam::ErrorCode]
19
+ # @param type [Symbol, :tool_search_tool_result_error]
20
+
21
+ # @see Anthropic::Models::Beta::BetaToolSearchToolResultErrorParam#error_code
22
+ module ErrorCode
23
+ extend Anthropic::Internal::Type::Enum
24
+
25
+ INVALID_TOOL_INPUT = :invalid_tool_input
26
+ UNAVAILABLE = :unavailable
27
+ TOO_MANY_REQUESTS = :too_many_requests
28
+ EXECUTION_TIME_EXCEEDED = :execution_time_exceeded
29
+
30
+ # @!method self.values
31
+ # @return [Array<Symbol>]
32
+ end
33
+ end
34
+ end
35
+
36
+ BetaToolSearchToolResultErrorParam = Beta::BetaToolSearchToolResultErrorParam
37
+ end
38
+ end
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Anthropic
4
+ module Models
5
+ module Beta
6
+ class BetaToolSearchToolSearchResultBlock < Anthropic::Internal::Type::BaseModel
7
+ # @!attribute tool_references
8
+ #
9
+ # @return [Array<Anthropic::Models::Beta::BetaToolReferenceBlock>]
10
+ required :tool_references,
11
+ -> { Anthropic::Internal::Type::ArrayOf[Anthropic::Beta::BetaToolReferenceBlock] }
12
+
13
+ # @!attribute type
14
+ #
15
+ # @return [Symbol, :tool_search_tool_search_result]
16
+ required :type, const: :tool_search_tool_search_result
17
+
18
+ # @!method initialize(tool_references:, type: :tool_search_tool_search_result)
19
+ # @param tool_references [Array<Anthropic::Models::Beta::BetaToolReferenceBlock>]
20
+ # @param type [Symbol, :tool_search_tool_search_result]
21
+ end
22
+ end
23
+
24
+ BetaToolSearchToolSearchResultBlock = Beta::BetaToolSearchToolSearchResultBlock
25
+ end
26
+ end
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Anthropic
4
+ module Models
5
+ module Beta
6
+ class BetaToolSearchToolSearchResultBlockParam < Anthropic::Internal::Type::BaseModel
7
+ # @!attribute tool_references
8
+ #
9
+ # @return [Array<Anthropic::Models::Beta::BetaToolReferenceBlockParam>]
10
+ required :tool_references,
11
+ -> { Anthropic::Internal::Type::ArrayOf[Anthropic::Beta::BetaToolReferenceBlockParam] }
12
+
13
+ # @!attribute type
14
+ #
15
+ # @return [Symbol, :tool_search_tool_search_result]
16
+ required :type, const: :tool_search_tool_search_result
17
+
18
+ # @!method initialize(tool_references:, type: :tool_search_tool_search_result)
19
+ # @param tool_references [Array<Anthropic::Models::Beta::BetaToolReferenceBlockParam>]
20
+ # @param type [Symbol, :tool_search_tool_search_result]
21
+ end
22
+ end
23
+
24
+ BetaToolSearchToolSearchResultBlockParam = Beta::BetaToolSearchToolSearchResultBlockParam
25
+ end
26
+ end
@@ -17,28 +17,63 @@ module Anthropic
17
17
  # @return [Symbol, :text_editor_20241022]
18
18
  required :type, const: :text_editor_20241022
19
19
 
20
+ # @!attribute allowed_callers
21
+ #
22
+ # @return [Array<Symbol, Anthropic::Models::Beta::BetaToolTextEditor20241022::AllowedCaller>, nil]
23
+ optional :allowed_callers,
24
+ -> { Anthropic::Internal::Type::ArrayOf[enum: Anthropic::Beta::BetaToolTextEditor20241022::AllowedCaller] }
25
+
20
26
  # @!attribute cache_control
21
27
  # Create a cache control breakpoint at this content block.
22
28
  #
23
29
  # @return [Anthropic::Models::Beta::BetaCacheControlEphemeral, nil]
24
30
  optional :cache_control, -> { Anthropic::Beta::BetaCacheControlEphemeral }, nil?: true
25
31
 
32
+ # @!attribute defer_loading
33
+ # If true, tool will not be included in initial system prompt. Only loaded when
34
+ # returned via tool_reference from tool search.
35
+ #
36
+ # @return [Boolean, nil]
37
+ optional :defer_loading, Anthropic::Internal::Type::Boolean
38
+
39
+ # @!attribute input_examples
40
+ #
41
+ # @return [Array<Hash{Symbol=>Object}>, nil]
42
+ optional :input_examples,
43
+ Anthropic::Internal::Type::ArrayOf[Anthropic::Internal::Type::HashOf[Anthropic::Internal::Type::Unknown]]
44
+
26
45
  # @!attribute strict
27
46
  #
28
47
  # @return [Boolean, nil]
29
48
  optional :strict, Anthropic::Internal::Type::Boolean
30
49
 
31
- # @!method initialize(cache_control: nil, strict: nil, name: :str_replace_editor, type: :text_editor_20241022)
50
+ # @!method initialize(allowed_callers: nil, cache_control: nil, defer_loading: nil, input_examples: nil, strict: nil, name: :str_replace_editor, type: :text_editor_20241022)
32
51
  # Some parameter documentations has been truncated, see
33
52
  # {Anthropic::Models::Beta::BetaToolTextEditor20241022} for more details.
34
53
  #
54
+ # @param allowed_callers [Array<Symbol, Anthropic::Models::Beta::BetaToolTextEditor20241022::AllowedCaller>]
55
+ #
35
56
  # @param cache_control [Anthropic::Models::Beta::BetaCacheControlEphemeral, nil] Create a cache control breakpoint at this content block.
36
57
  #
58
+ # @param defer_loading [Boolean] If true, tool will not be included in initial system prompt. Only loaded when re
59
+ #
60
+ # @param input_examples [Array<Hash{Symbol=>Object}>]
61
+ #
37
62
  # @param strict [Boolean]
38
63
  #
39
64
  # @param name [Symbol, :str_replace_editor] Name of the tool.
40
65
  #
41
66
  # @param type [Symbol, :text_editor_20241022]
67
+
68
+ module AllowedCaller
69
+ extend Anthropic::Internal::Type::Enum
70
+
71
+ DIRECT = :direct
72
+ CODE_EXECUTION_20250825 = :code_execution_20250825
73
+
74
+ # @!method self.values
75
+ # @return [Array<Symbol>]
76
+ end
42
77
  end
43
78
  end
44
79
 
@@ -17,28 +17,63 @@ module Anthropic
17
17
  # @return [Symbol, :text_editor_20250124]
18
18
  required :type, const: :text_editor_20250124
19
19
 
20
+ # @!attribute allowed_callers
21
+ #
22
+ # @return [Array<Symbol, Anthropic::Models::Beta::BetaToolTextEditor20250124::AllowedCaller>, nil]
23
+ optional :allowed_callers,
24
+ -> { Anthropic::Internal::Type::ArrayOf[enum: Anthropic::Beta::BetaToolTextEditor20250124::AllowedCaller] }
25
+
20
26
  # @!attribute cache_control
21
27
  # Create a cache control breakpoint at this content block.
22
28
  #
23
29
  # @return [Anthropic::Models::Beta::BetaCacheControlEphemeral, nil]
24
30
  optional :cache_control, -> { Anthropic::Beta::BetaCacheControlEphemeral }, nil?: true
25
31
 
32
+ # @!attribute defer_loading
33
+ # If true, tool will not be included in initial system prompt. Only loaded when
34
+ # returned via tool_reference from tool search.
35
+ #
36
+ # @return [Boolean, nil]
37
+ optional :defer_loading, Anthropic::Internal::Type::Boolean
38
+
39
+ # @!attribute input_examples
40
+ #
41
+ # @return [Array<Hash{Symbol=>Object}>, nil]
42
+ optional :input_examples,
43
+ Anthropic::Internal::Type::ArrayOf[Anthropic::Internal::Type::HashOf[Anthropic::Internal::Type::Unknown]]
44
+
26
45
  # @!attribute strict
27
46
  #
28
47
  # @return [Boolean, nil]
29
48
  optional :strict, Anthropic::Internal::Type::Boolean
30
49
 
31
- # @!method initialize(cache_control: nil, strict: nil, name: :str_replace_editor, type: :text_editor_20250124)
50
+ # @!method initialize(allowed_callers: nil, cache_control: nil, defer_loading: nil, input_examples: nil, strict: nil, name: :str_replace_editor, type: :text_editor_20250124)
32
51
  # Some parameter documentations has been truncated, see
33
52
  # {Anthropic::Models::Beta::BetaToolTextEditor20250124} for more details.
34
53
  #
54
+ # @param allowed_callers [Array<Symbol, Anthropic::Models::Beta::BetaToolTextEditor20250124::AllowedCaller>]
55
+ #
35
56
  # @param cache_control [Anthropic::Models::Beta::BetaCacheControlEphemeral, nil] Create a cache control breakpoint at this content block.
36
57
  #
58
+ # @param defer_loading [Boolean] If true, tool will not be included in initial system prompt. Only loaded when re
59
+ #
60
+ # @param input_examples [Array<Hash{Symbol=>Object}>]
61
+ #
37
62
  # @param strict [Boolean]
38
63
  #
39
64
  # @param name [Symbol, :str_replace_editor] Name of the tool.
40
65
  #
41
66
  # @param type [Symbol, :text_editor_20250124]
67
+
68
+ module AllowedCaller
69
+ extend Anthropic::Internal::Type::Enum
70
+
71
+ DIRECT = :direct
72
+ CODE_EXECUTION_20250825 = :code_execution_20250825
73
+
74
+ # @!method self.values
75
+ # @return [Array<Symbol>]
76
+ end
42
77
  end
43
78
  end
44
79
 
@@ -17,28 +17,63 @@ module Anthropic
17
17
  # @return [Symbol, :text_editor_20250429]
18
18
  required :type, const: :text_editor_20250429
19
19
 
20
+ # @!attribute allowed_callers
21
+ #
22
+ # @return [Array<Symbol, Anthropic::Models::Beta::BetaToolTextEditor20250429::AllowedCaller>, nil]
23
+ optional :allowed_callers,
24
+ -> { Anthropic::Internal::Type::ArrayOf[enum: Anthropic::Beta::BetaToolTextEditor20250429::AllowedCaller] }
25
+
20
26
  # @!attribute cache_control
21
27
  # Create a cache control breakpoint at this content block.
22
28
  #
23
29
  # @return [Anthropic::Models::Beta::BetaCacheControlEphemeral, nil]
24
30
  optional :cache_control, -> { Anthropic::Beta::BetaCacheControlEphemeral }, nil?: true
25
31
 
32
+ # @!attribute defer_loading
33
+ # If true, tool will not be included in initial system prompt. Only loaded when
34
+ # returned via tool_reference from tool search.
35
+ #
36
+ # @return [Boolean, nil]
37
+ optional :defer_loading, Anthropic::Internal::Type::Boolean
38
+
39
+ # @!attribute input_examples
40
+ #
41
+ # @return [Array<Hash{Symbol=>Object}>, nil]
42
+ optional :input_examples,
43
+ Anthropic::Internal::Type::ArrayOf[Anthropic::Internal::Type::HashOf[Anthropic::Internal::Type::Unknown]]
44
+
26
45
  # @!attribute strict
27
46
  #
28
47
  # @return [Boolean, nil]
29
48
  optional :strict, Anthropic::Internal::Type::Boolean
30
49
 
31
- # @!method initialize(cache_control: nil, strict: nil, name: :str_replace_based_edit_tool, type: :text_editor_20250429)
50
+ # @!method initialize(allowed_callers: nil, cache_control: nil, defer_loading: nil, input_examples: nil, strict: nil, name: :str_replace_based_edit_tool, type: :text_editor_20250429)
32
51
  # Some parameter documentations has been truncated, see
33
52
  # {Anthropic::Models::Beta::BetaToolTextEditor20250429} for more details.
34
53
  #
54
+ # @param allowed_callers [Array<Symbol, Anthropic::Models::Beta::BetaToolTextEditor20250429::AllowedCaller>]
55
+ #
35
56
  # @param cache_control [Anthropic::Models::Beta::BetaCacheControlEphemeral, nil] Create a cache control breakpoint at this content block.
36
57
  #
58
+ # @param defer_loading [Boolean] If true, tool will not be included in initial system prompt. Only loaded when re
59
+ #
60
+ # @param input_examples [Array<Hash{Symbol=>Object}>]
61
+ #
37
62
  # @param strict [Boolean]
38
63
  #
39
64
  # @param name [Symbol, :str_replace_based_edit_tool] Name of the tool.
40
65
  #
41
66
  # @param type [Symbol, :text_editor_20250429]
67
+
68
+ module AllowedCaller
69
+ extend Anthropic::Internal::Type::Enum
70
+
71
+ DIRECT = :direct
72
+ CODE_EXECUTION_20250825 = :code_execution_20250825
73
+
74
+ # @!method self.values
75
+ # @return [Array<Symbol>]
76
+ end
42
77
  end
43
78
  end
44
79
 
@@ -17,12 +17,31 @@ module Anthropic
17
17
  # @return [Symbol, :text_editor_20250728]
18
18
  required :type, const: :text_editor_20250728
19
19
 
20
+ # @!attribute allowed_callers
21
+ #
22
+ # @return [Array<Symbol, Anthropic::Models::Beta::BetaToolTextEditor20250728::AllowedCaller>, nil]
23
+ optional :allowed_callers,
24
+ -> { Anthropic::Internal::Type::ArrayOf[enum: Anthropic::Beta::BetaToolTextEditor20250728::AllowedCaller] }
25
+
20
26
  # @!attribute cache_control
21
27
  # Create a cache control breakpoint at this content block.
22
28
  #
23
29
  # @return [Anthropic::Models::Beta::BetaCacheControlEphemeral, nil]
24
30
  optional :cache_control, -> { Anthropic::Beta::BetaCacheControlEphemeral }, nil?: true
25
31
 
32
+ # @!attribute defer_loading
33
+ # If true, tool will not be included in initial system prompt. Only loaded when
34
+ # returned via tool_reference from tool search.
35
+ #
36
+ # @return [Boolean, nil]
37
+ optional :defer_loading, Anthropic::Internal::Type::Boolean
38
+
39
+ # @!attribute input_examples
40
+ #
41
+ # @return [Array<Hash{Symbol=>Object}>, nil]
42
+ optional :input_examples,
43
+ Anthropic::Internal::Type::ArrayOf[Anthropic::Internal::Type::HashOf[Anthropic::Internal::Type::Unknown]]
44
+
26
45
  # @!attribute max_characters
27
46
  # Maximum number of characters to display when viewing a file. If not specified,
28
47
  # defaults to displaying the full file.
@@ -35,12 +54,18 @@ module Anthropic
35
54
  # @return [Boolean, nil]
36
55
  optional :strict, Anthropic::Internal::Type::Boolean
37
56
 
38
- # @!method initialize(cache_control: nil, max_characters: nil, strict: nil, name: :str_replace_based_edit_tool, type: :text_editor_20250728)
57
+ # @!method initialize(allowed_callers: nil, cache_control: nil, defer_loading: nil, input_examples: nil, max_characters: nil, strict: nil, name: :str_replace_based_edit_tool, type: :text_editor_20250728)
39
58
  # Some parameter documentations has been truncated, see
40
59
  # {Anthropic::Models::Beta::BetaToolTextEditor20250728} for more details.
41
60
  #
61
+ # @param allowed_callers [Array<Symbol, Anthropic::Models::Beta::BetaToolTextEditor20250728::AllowedCaller>]
62
+ #
42
63
  # @param cache_control [Anthropic::Models::Beta::BetaCacheControlEphemeral, nil] Create a cache control breakpoint at this content block.
43
64
  #
65
+ # @param defer_loading [Boolean] If true, tool will not be included in initial system prompt. Only loaded when re
66
+ #
67
+ # @param input_examples [Array<Hash{Symbol=>Object}>]
68
+ #
44
69
  # @param max_characters [Integer, nil] Maximum number of characters to display when viewing a file. If not specified, d
45
70
  #
46
71
  # @param strict [Boolean]
@@ -48,6 +73,16 @@ module Anthropic
48
73
  # @param name [Symbol, :str_replace_based_edit_tool] Name of the tool.
49
74
  #
50
75
  # @param type [Symbol, :text_editor_20250728]
76
+
77
+ module AllowedCaller
78
+ extend Anthropic::Internal::Type::Enum
79
+
80
+ DIRECT = :direct
81
+ CODE_EXECUTION_20250825 = :code_execution_20250825
82
+
83
+ # @!method self.values
84
+ # @return [Array<Symbol>]
85
+ end
51
86
  end
52
87
  end
53
88
 
@@ -3,6 +3,10 @@
3
3
  module Anthropic
4
4
  module Models
5
5
  module Beta
6
+ # Configuration for a group of tools from an MCP server.
7
+ #
8
+ # Allows configuring enabled status and defer_loading for all tools from an MCP
9
+ # server, with optional per-tool overrides.
6
10
  module BetaToolUnion
7
11
  extend Anthropic::Internal::Type::Union
8
12
 
@@ -24,6 +28,8 @@ module Anthropic
24
28
 
25
29
  variant -> { Anthropic::Beta::BetaToolTextEditor20241022 }
26
30
 
31
+ variant -> { Anthropic::Beta::BetaToolComputerUse20251124 }
32
+
27
33
  variant -> { Anthropic::Beta::BetaToolTextEditor20250124 }
28
34
 
29
35
  variant -> { Anthropic::Beta::BetaToolTextEditor20250429 }
@@ -34,8 +40,18 @@ module Anthropic
34
40
 
35
41
  variant -> { Anthropic::Beta::BetaWebFetchTool20250910 }
36
42
 
43
+ variant -> { Anthropic::Beta::BetaToolSearchToolBm25_20251119 }
44
+
45
+ variant -> { Anthropic::Beta::BetaToolSearchToolRegex20251119 }
46
+
47
+ # Configuration for a group of tools from an MCP server.
48
+ #
49
+ # Allows configuring enabled status and defer_loading for all tools
50
+ # from an MCP server, with optional per-tool overrides.
51
+ variant -> { Anthropic::Beta::BetaMCPToolset }
52
+
37
53
  # @!method self.variants
38
- # @return [Array(Anthropic::Models::Beta::BetaTool, Anthropic::Models::Beta::BetaToolBash20241022, Anthropic::Models::Beta::BetaToolBash20250124, Anthropic::Models::Beta::BetaCodeExecutionTool20250522, Anthropic::Models::Beta::BetaCodeExecutionTool20250825, Anthropic::Models::Beta::BetaToolComputerUse20241022, Anthropic::Models::Beta::BetaMemoryTool20250818, Anthropic::Models::Beta::BetaToolComputerUse20250124, Anthropic::Models::Beta::BetaToolTextEditor20241022, Anthropic::Models::Beta::BetaToolTextEditor20250124, Anthropic::Models::Beta::BetaToolTextEditor20250429, Anthropic::Models::Beta::BetaToolTextEditor20250728, Anthropic::Models::Beta::BetaWebSearchTool20250305, Anthropic::Models::Beta::BetaWebFetchTool20250910)]
54
+ # @return [Array(Anthropic::Models::Beta::BetaTool, Anthropic::Models::Beta::BetaToolBash20241022, Anthropic::Models::Beta::BetaToolBash20250124, Anthropic::Models::Beta::BetaCodeExecutionTool20250522, Anthropic::Models::Beta::BetaCodeExecutionTool20250825, Anthropic::Models::Beta::BetaToolComputerUse20241022, Anthropic::Models::Beta::BetaMemoryTool20250818, Anthropic::Models::Beta::BetaToolComputerUse20250124, Anthropic::Models::Beta::BetaToolTextEditor20241022, Anthropic::Models::Beta::BetaToolComputerUse20251124, Anthropic::Models::Beta::BetaToolTextEditor20250124, Anthropic::Models::Beta::BetaToolTextEditor20250429, Anthropic::Models::Beta::BetaToolTextEditor20250728, Anthropic::Models::Beta::BetaWebSearchTool20250305, Anthropic::Models::Beta::BetaWebFetchTool20250910, Anthropic::Models::Beta::BetaToolSearchToolBm25_20251119, Anthropic::Models::Beta::BetaToolSearchToolRegex20251119, Anthropic::Models::Beta::BetaMCPToolset)]
39
55
  end
40
56
  end
41
57
 
@@ -24,6 +24,12 @@ module Anthropic
24
24
  # @return [Symbol, :tool_use]
25
25
  required :type, const: :tool_use
26
26
 
27
+ # @!attribute caller_
28
+ # Tool invocation directly from the model.
29
+ #
30
+ # @return [Anthropic::Models::Beta::BetaDirectCaller, Anthropic::Models::Beta::BetaServerToolCaller, nil]
31
+ optional :caller_, union: -> { Anthropic::Beta::BetaToolUseBlock::Caller }, api_name: :caller
32
+
27
33
  response_only do
28
34
  # @api public
29
35
  #
@@ -38,11 +44,34 @@ module Anthropic
38
44
  optional :_json_buf, String
39
45
  end
40
46
 
41
- # @!method initialize(id:, input:, name:, type: :tool_use)
47
+ # @!method initialize(id:, input:, name:, caller_: nil, type: :tool_use)
42
48
  # @param id [String]
49
+ #
43
50
  # @param input [Object]
51
+ #
44
52
  # @param name [String]
53
+ #
54
+ # @param caller_ [Anthropic::Models::Beta::BetaDirectCaller, Anthropic::Models::Beta::BetaServerToolCaller] Tool invocation directly from the model.
55
+ #
45
56
  # @param type [Symbol, :tool_use]
57
+
58
+ # Tool invocation directly from the model.
59
+ #
60
+ # @see Anthropic::Models::Beta::BetaToolUseBlock#caller_
61
+ module Caller
62
+ extend Anthropic::Internal::Type::Union
63
+
64
+ discriminator :type
65
+
66
+ # Tool invocation directly from the model.
67
+ variant :direct, -> { Anthropic::Beta::BetaDirectCaller }
68
+
69
+ # Tool invocation generated by a server-side tool.
70
+ variant :code_execution_20250825, -> { Anthropic::Beta::BetaServerToolCaller }
71
+
72
+ # @!method self.variants
73
+ # @return [Array(Anthropic::Models::Beta::BetaDirectCaller, Anthropic::Models::Beta::BetaServerToolCaller)]
74
+ end
46
75
  end
47
76
  end
48
77
 
@@ -30,7 +30,13 @@ module Anthropic
30
30
  # @return [Anthropic::Models::Beta::BetaCacheControlEphemeral, nil]
31
31
  optional :cache_control, -> { Anthropic::Beta::BetaCacheControlEphemeral }, nil?: true
32
32
 
33
- # @!method initialize(id:, input:, name:, cache_control: nil, type: :tool_use)
33
+ # @!attribute caller_
34
+ # Tool invocation directly from the model.
35
+ #
36
+ # @return [Anthropic::Models::Beta::BetaDirectCaller, Anthropic::Models::Beta::BetaServerToolCaller, nil]
37
+ optional :caller_, union: -> { Anthropic::Beta::BetaToolUseBlockParam::Caller }, api_name: :caller
38
+
39
+ # @!method initialize(id:, input:, name:, cache_control: nil, caller_: nil, type: :tool_use)
34
40
  # @param id [String]
35
41
  #
36
42
  # @param input [Hash{Symbol=>Object}]
@@ -39,7 +45,27 @@ module Anthropic
39
45
  #
40
46
  # @param cache_control [Anthropic::Models::Beta::BetaCacheControlEphemeral, nil] Create a cache control breakpoint at this content block.
41
47
  #
48
+ # @param caller_ [Anthropic::Models::Beta::BetaDirectCaller, Anthropic::Models::Beta::BetaServerToolCaller] Tool invocation directly from the model.
49
+ #
42
50
  # @param type [Symbol, :tool_use]
51
+
52
+ # Tool invocation directly from the model.
53
+ #
54
+ # @see Anthropic::Models::Beta::BetaToolUseBlockParam#caller_
55
+ module Caller
56
+ extend Anthropic::Internal::Type::Union
57
+
58
+ discriminator :type
59
+
60
+ # Tool invocation directly from the model.
61
+ variant :direct, -> { Anthropic::Beta::BetaDirectCaller }
62
+
63
+ # Tool invocation generated by a server-side tool.
64
+ variant :code_execution_20250825, -> { Anthropic::Beta::BetaServerToolCaller }
65
+
66
+ # @!method self.variants
67
+ # @return [Array(Anthropic::Models::Beta::BetaDirectCaller, Anthropic::Models::Beta::BetaServerToolCaller)]
68
+ end
43
69
  end
44
70
  end
45
71
 
@@ -17,6 +17,12 @@ module Anthropic
17
17
  # @return [Symbol, :web_fetch_20250910]
18
18
  required :type, const: :web_fetch_20250910
19
19
 
20
+ # @!attribute allowed_callers
21
+ #
22
+ # @return [Array<Symbol, Anthropic::Models::Beta::BetaWebFetchTool20250910::AllowedCaller>, nil]
23
+ optional :allowed_callers,
24
+ -> { Anthropic::Internal::Type::ArrayOf[enum: Anthropic::Beta::BetaWebFetchTool20250910::AllowedCaller] }
25
+
20
26
  # @!attribute allowed_domains
21
27
  # List of domains to allow fetching from
22
28
  #
@@ -42,6 +48,13 @@ module Anthropic
42
48
  # @return [Anthropic::Models::Beta::BetaCitationsConfigParam, nil]
43
49
  optional :citations, -> { Anthropic::Beta::BetaCitationsConfigParam }, nil?: true
44
50
 
51
+ # @!attribute defer_loading
52
+ # If true, tool will not be included in initial system prompt. Only loaded when
53
+ # returned via tool_reference from tool search.
54
+ #
55
+ # @return [Boolean, nil]
56
+ optional :defer_loading, Anthropic::Internal::Type::Boolean
57
+
45
58
  # @!attribute max_content_tokens
46
59
  # Maximum number of tokens used by including web page text content in the context.
47
60
  # The limit is approximate and does not apply to binary content such as PDFs.
@@ -60,10 +73,12 @@ module Anthropic
60
73
  # @return [Boolean, nil]
61
74
  optional :strict, Anthropic::Internal::Type::Boolean
62
75
 
63
- # @!method initialize(allowed_domains: nil, blocked_domains: nil, cache_control: nil, citations: nil, max_content_tokens: nil, max_uses: nil, strict: nil, name: :web_fetch, type: :web_fetch_20250910)
76
+ # @!method initialize(allowed_callers: nil, allowed_domains: nil, blocked_domains: nil, cache_control: nil, citations: nil, defer_loading: nil, max_content_tokens: nil, max_uses: nil, strict: nil, name: :web_fetch, type: :web_fetch_20250910)
64
77
  # Some parameter documentations has been truncated, see
65
78
  # {Anthropic::Models::Beta::BetaWebFetchTool20250910} for more details.
66
79
  #
80
+ # @param allowed_callers [Array<Symbol, Anthropic::Models::Beta::BetaWebFetchTool20250910::AllowedCaller>]
81
+ #
67
82
  # @param allowed_domains [Array<String>, nil] List of domains to allow fetching from
68
83
  #
69
84
  # @param blocked_domains [Array<String>, nil] List of domains to block fetching from
@@ -72,6 +87,8 @@ module Anthropic
72
87
  #
73
88
  # @param citations [Anthropic::Models::Beta::BetaCitationsConfigParam, nil] Citations configuration for fetched documents. Citations are disabled by default
74
89
  #
90
+ # @param defer_loading [Boolean] If true, tool will not be included in initial system prompt. Only loaded when re
91
+ #
75
92
  # @param max_content_tokens [Integer, nil] Maximum number of tokens used by including web page text content in the context.
76
93
  #
77
94
  # @param max_uses [Integer, nil] Maximum number of times the tool can be used in the API request.
@@ -81,6 +98,16 @@ module Anthropic
81
98
  # @param name [Symbol, :web_fetch] Name of the tool.
82
99
  #
83
100
  # @param type [Symbol, :web_fetch_20250910]
101
+
102
+ module AllowedCaller
103
+ extend Anthropic::Internal::Type::Enum
104
+
105
+ DIRECT = :direct
106
+ CODE_EXECUTION_20250825 = :code_execution_20250825
107
+
108
+ # @!method self.values
109
+ # @return [Array<Symbol>]
110
+ end
84
111
  end
85
112
  end
86
113
 
@@ -17,6 +17,12 @@ module Anthropic
17
17
  # @return [Symbol, :web_search_20250305]
18
18
  required :type, const: :web_search_20250305
19
19
 
20
+ # @!attribute allowed_callers
21
+ #
22
+ # @return [Array<Symbol, Anthropic::Models::Beta::BetaWebSearchTool20250305::AllowedCaller>, nil]
23
+ optional :allowed_callers,
24
+ -> { Anthropic::Internal::Type::ArrayOf[enum: Anthropic::Beta::BetaWebSearchTool20250305::AllowedCaller] }
25
+
20
26
  # @!attribute allowed_domains
21
27
  # If provided, only these domains will be included in results. Cannot be used
22
28
  # alongside `blocked_domains`.
@@ -37,6 +43,13 @@ module Anthropic
37
43
  # @return [Anthropic::Models::Beta::BetaCacheControlEphemeral, nil]
38
44
  optional :cache_control, -> { Anthropic::Beta::BetaCacheControlEphemeral }, nil?: true
39
45
 
46
+ # @!attribute defer_loading
47
+ # If true, tool will not be included in initial system prompt. Only loaded when
48
+ # returned via tool_reference from tool search.
49
+ #
50
+ # @return [Boolean, nil]
51
+ optional :defer_loading, Anthropic::Internal::Type::Boolean
52
+
40
53
  # @!attribute max_uses
41
54
  # Maximum number of times the tool can be used in the API request.
42
55
  #
@@ -55,16 +68,20 @@ module Anthropic
55
68
  # @return [Anthropic::Models::Beta::BetaWebSearchTool20250305::UserLocation, nil]
56
69
  optional :user_location, -> { Anthropic::Beta::BetaWebSearchTool20250305::UserLocation }, nil?: true
57
70
 
58
- # @!method initialize(allowed_domains: nil, blocked_domains: nil, cache_control: nil, max_uses: nil, strict: nil, user_location: nil, name: :web_search, type: :web_search_20250305)
71
+ # @!method initialize(allowed_callers: nil, allowed_domains: nil, blocked_domains: nil, cache_control: nil, defer_loading: nil, max_uses: nil, strict: nil, user_location: nil, name: :web_search, type: :web_search_20250305)
59
72
  # Some parameter documentations has been truncated, see
60
73
  # {Anthropic::Models::Beta::BetaWebSearchTool20250305} for more details.
61
74
  #
75
+ # @param allowed_callers [Array<Symbol, Anthropic::Models::Beta::BetaWebSearchTool20250305::AllowedCaller>]
76
+ #
62
77
  # @param allowed_domains [Array<String>, nil] If provided, only these domains will be included in results. Cannot be used alon
63
78
  #
64
79
  # @param blocked_domains [Array<String>, nil] If provided, these domains will never appear in results. Cannot be used alongsid
65
80
  #
66
81
  # @param cache_control [Anthropic::Models::Beta::BetaCacheControlEphemeral, nil] Create a cache control breakpoint at this content block.
67
82
  #
83
+ # @param defer_loading [Boolean] If true, tool will not be included in initial system prompt. Only loaded when re
84
+ #
68
85
  # @param max_uses [Integer, nil] Maximum number of times the tool can be used in the API request.
69
86
  #
70
87
  # @param strict [Boolean]
@@ -75,6 +92,16 @@ module Anthropic
75
92
  #
76
93
  # @param type [Symbol, :web_search_20250305]
77
94
 
95
+ module AllowedCaller
96
+ extend Anthropic::Internal::Type::Enum
97
+
98
+ DIRECT = :direct
99
+ CODE_EXECUTION_20250825 = :code_execution_20250825
100
+
101
+ # @!method self.values
102
+ # @return [Array<Symbol>]
103
+ end
104
+
78
105
  # @see Anthropic::Models::Beta::BetaWebSearchTool20250305#user_location
79
106
  class UserLocation < Anthropic::Internal::Type::BaseModel
80
107
  # @!attribute type