@effect/ai-anthropic 4.0.0-beta.70 → 4.0.0-beta.71

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.
@@ -1,8 +1,58 @@
1
1
  /**
2
- * Anthropic provider-defined tools for use with the LanguageModel.
2
+ * The `AnthropicTool` module defines Anthropic provider tools that can be
3
+ * attached to Anthropic-backed Effect AI language model requests. These are
4
+ * provider-defined tools: Anthropic owns the tool names, argument formats,
5
+ * beta headers, and in some cases the execution environment.
6
+ *
7
+ * **Mental model**
8
+ *
9
+ * - Exports such as {@link Bash_20250124}, {@link CodeExecution_20250825},
10
+ * {@link ComputerUse_20250124}, and {@link WebSearch_20250305} create
11
+ * versioned provider-defined tool values understood by the Anthropic
12
+ * language model integration
13
+ * - Tool-specific `Schema` exports describe the arguments Claude may provide
14
+ * when invoking that provider tool
15
+ * - Some tools run on Anthropic infrastructure, such as
16
+ * {@link WebSearch_20250305}, {@link WebFetch_20250910}, and
17
+ * {@link CodeExecution_20250825}; handler-backed tools such as Bash,
18
+ * Computer Use, and Text Editor variants require application-side execution
19
+ * - Selecting a versioned tool lets the Anthropic model layer add the beta
20
+ * header required by that exact Anthropic API version
21
+ *
22
+ * **Common tasks**
23
+ *
24
+ * - Enable terminal-style actions with {@link Bash_20250124}
25
+ * - Enable sandboxed code execution with {@link CodeExecution_20250825}
26
+ * - Enable desktop automation payloads with {@link ComputerUse_20250124}
27
+ * - Enable persistent memory file operations with {@link Memory_20250818}
28
+ * - Enable text-editor commands with {@link TextEditor_20250728}
29
+ * - Enable hosted web capabilities with {@link WebSearch_20250305} or
30
+ * {@link WebFetch_20250910}
31
+ * - Restrict tool discovery with {@link ToolSearchRegex_20251119} or
32
+ * {@link ToolSearchBM25_20251119}
33
+ *
34
+ * **Quickstart**
35
+ *
36
+ * **Example** (Creating hosted Anthropic tools)
37
+ *
38
+ * ```ts
39
+ * import { AnthropicTool } from "@effect/ai-anthropic"
40
+ *
41
+ * const tools = [
42
+ * AnthropicTool.WebSearch_20250305({ maxUses: 3 }),
43
+ * AnthropicTool.WebFetch_20250910({
44
+ * citations: { enabled: true }
45
+ * })
46
+ * ]
47
+ * ```
3
48
  *
4
- * Provides tools that are natively supported by Anthropic's API, including
5
- * Bash, Code Execution, Computer Use, Memory, and Text Editor functionality.
49
+ * **Gotchas**
50
+ *
51
+ * - The suffix date is part of the Anthropic tool contract; choose the version
52
+ * that matches the model and beta behavior you intend to use
53
+ * - Handler-backed tools expose schemas for Claude's requested actions, but
54
+ * your runtime is responsible for performing those actions and returning
55
+ * results
6
56
  *
7
57
  * @since 4.0.0
8
58
  */
@@ -11,7 +61,18 @@ import * as Tool from "effect/unstable/ai/Tool"
11
61
  import * as Generated from "./Generated.ts"
12
62
 
13
63
  /**
14
- * Union of all Anthropic provider-defined tools.
64
+ * Union of all Anthropic provider-defined tool definitions exported by this module.
65
+ *
66
+ * **When to use**
67
+ *
68
+ * Use when a helper, collection, or option accepts any Anthropic
69
+ * provider-defined tool value created by this module.
70
+ *
71
+ * **Details**
72
+ *
73
+ * The union is built from the return types of the exported constructors,
74
+ * including Bash, Code Execution, Computer Use, Memory, Text Editor, Tool
75
+ * Search, Web Fetch, and Web Search tool versions.
15
76
  *
16
77
  * @category models
17
78
  * @since 4.0.0
@@ -41,11 +102,18 @@ export type AnthropicTool =
41
102
  /**
42
103
  * Anthropic Bash tool (2024-10-22 version).
43
104
  *
105
+ * **When to use**
106
+ *
107
+ * Use when you need the model to execute bash commands and require the 2024-10-22
108
+ * version of the Anthropic computer-use beta.
109
+ *
44
110
  * **Details**
45
111
  *
46
112
  * Allows the model to execute bash commands in a sandboxed environment.
47
113
  * Requires the "computer-use-2024-10-22" beta header.
48
114
  *
115
+ * @see {@link Bash_20250124} for the newer 2025-01-24 version of the bash tool
116
+ *
49
117
  * @category Bash
50
118
  * @since 4.0.0
51
119
  */
@@ -64,11 +132,18 @@ export const Bash_20241022 = Tool.providerDefined({
64
132
  /**
65
133
  * Anthropic Bash tool (2025-01-24 version).
66
134
  *
135
+ * **When to use**
136
+ *
137
+ * Use when you need the model to execute bash commands and require the 2025-01-24
138
+ * version of the Anthropic computer-use beta.
139
+ *
67
140
  * **Details**
68
141
  *
69
142
  * Allows the model to execute bash commands in a sandboxed environment.
70
143
  * Requires the "computer-use-2025-01-24" beta header.
71
144
  *
145
+ * @see {@link Bash_20241022} for the older 2024-10-22 version of the bash tool
146
+ *
72
147
  * @category Bash
73
148
  * @since 4.0.0
74
149
  */
@@ -95,6 +170,13 @@ export const Bash_20250124 = Tool.providerDefined({
95
170
  /**
96
171
  * Schema for a code execution request that asks Anthropic to run source code as a programmatic tool call.
97
172
  *
173
+ * **When to use**
174
+ *
175
+ * Use when constructing or validating a programmatic tool call for the Anthropic
176
+ * Code Execution tool.
177
+ *
178
+ * @see {@link CodeExecution_20250522} for the parent tool definition
179
+ *
98
180
  * @category Code Execution
99
181
  * @since 4.0.0
100
182
  */
@@ -114,7 +196,19 @@ export const CodeExecutionProgrammaticToolCall = Schema.Struct({
114
196
  export type CodeExecutionProgrammaticToolCall = typeof CodeExecutionProgrammaticToolCall.Type
115
197
 
116
198
  /**
117
- * Schema for a code execution request that runs a bash command.
199
+ * Schema for the `bash_code_execution` input variant of Anthropic Code Execution.
200
+ *
201
+ * **When to use**
202
+ *
203
+ * Use when validating or constructing a bash command request for
204
+ * `CodeExecution_20250522`.
205
+ *
206
+ * **Details**
207
+ *
208
+ * The schema requires `type` to be `"bash_code_execution"` and `command` to
209
+ * contain the bash command sent to Anthropic.
210
+ *
211
+ * @see {@link CodeExecution_20250522} for the provider-defined tool that consumes this input variant
118
212
  *
119
213
  * @category Code Execution
120
214
  * @since 4.0.0
@@ -127,7 +221,24 @@ export const CodeExecutionBashCommand = Schema.Struct({
127
221
  command: Schema.String
128
222
  })
129
223
  /**
130
- * Input payload for a bash command executed through Anthropic code execution.
224
+ * Input payload for a bash command routed through the Anthropic code execution tool.
225
+ *
226
+ * **When to use**
227
+ *
228
+ * Use when representing a provider-executed bash command request for the
229
+ * 2025-05-22 code execution tool.
230
+ *
231
+ * **Details**
232
+ *
233
+ * The payload uses `type: "bash_code_execution"` to distinguish bash execution
234
+ * from programmatic code and text editor operations, and `command` contains the
235
+ * bash command to run.
236
+ *
237
+ * @see {@link CodeExecutionProgrammaticToolCall} for programmatic code execution input
238
+ * @see {@link CodeExecutionTextEditorView} for viewing files through text editor code execution
239
+ * @see {@link CodeExecutionTextEditorCreate} for creating files through text editor code execution
240
+ * @see {@link CodeExecutionTextEditorStrReplace} for replacing text through text editor code execution
241
+ * @see {@link CodeExecution_20250522} for the provider-defined tool that consumes this payload
131
242
  *
132
243
  * @category Code Execution
133
244
  * @since 4.0.0
@@ -135,7 +246,20 @@ export const CodeExecutionBashCommand = Schema.Struct({
135
246
  export type CodeExecutionBashCommand = typeof CodeExecutionBashCommand.Type
136
247
 
137
248
  /**
138
- * Text editor view command for code execution.
249
+ * Schema for a code execution text editor request that views a file by path.
250
+ *
251
+ * **When to use**
252
+ *
253
+ * Use to validate or construct the `view` command for Anthropic code execution
254
+ * text editor tool calls.
255
+ *
256
+ * **Details**
257
+ *
258
+ * The encoded payload uses `type: "text_editor_code_execution"`,
259
+ * `command: "view"`, and a `path` string.
260
+ *
261
+ * @see {@link CodeExecutionTextEditorCreate} for the command that creates a file
262
+ * @see {@link CodeExecutionTextEditorStrReplace} for the command that replaces text in a file
139
263
  *
140
264
  * @category Code Execution
141
265
  * @since 4.0.0
@@ -149,7 +273,26 @@ export const CodeExecutionTextEditorView = Schema.Struct({
149
273
  path: Schema.String
150
274
  })
151
275
  /**
152
- * Input payload for viewing a file through the text editor code execution tool.
276
+ * Input payload for the `view` command of Anthropic's text editor code execution tool.
277
+ *
278
+ * **When to use**
279
+ *
280
+ * Use when handling or validating the `view` command for Anthropic's text
281
+ * editor code execution tool.
282
+ *
283
+ * **Details**
284
+ *
285
+ * The payload is discriminated by `type: "text_editor_code_execution"` and
286
+ * `command: "view"`. The `path` field identifies the file to view.
287
+ *
288
+ * **Gotchas**
289
+ *
290
+ * This code execution view payload does not include `view_range`; line ranges
291
+ * are part of the standalone text editor view payload, not this code execution
292
+ * payload.
293
+ *
294
+ * @see {@link CodeExecution_20250522} for the provider-defined code execution tool that includes this payload
295
+ * @see {@link TextEditorViewCommand} for the standalone text editor view payload
153
296
  *
154
297
  * @category Code Execution
155
298
  * @since 4.0.0
@@ -157,7 +300,22 @@ export const CodeExecutionTextEditorView = Schema.Struct({
157
300
  export type CodeExecutionTextEditorView = typeof CodeExecutionTextEditorView.Type
158
301
 
159
302
  /**
160
- * Text editor create command for code execution.
303
+ * Schema for a text editor code execution request that creates a file at a path.
304
+ *
305
+ * **When to use**
306
+ *
307
+ * Use when validating or constructing an Anthropic `text_editor_code_execution`
308
+ * tool call that should create a file.
309
+ *
310
+ * **Details**
311
+ *
312
+ * The request is discriminated by `type: "text_editor_code_execution"` and
313
+ * `command: "create"`. It requires `path` and accepts optional `file_text`; the
314
+ * schema allows `file_text` to be omitted, `null`, or a string.
315
+ *
316
+ * @see {@link CodeExecution_20250522} for the provider-defined tool that consumes this request
317
+ * @see {@link CodeExecutionTextEditorView} for the matching view request
318
+ * @see {@link CodeExecutionTextEditorStrReplace} for the matching replace request
161
319
  *
162
320
  * @category Code Execution
163
321
  * @since 4.0.0
@@ -183,7 +341,20 @@ export const CodeExecutionTextEditorCreate = Schema.Struct({
183
341
  export type CodeExecutionTextEditorCreate = typeof CodeExecutionTextEditorCreate.Type
184
342
 
185
343
  /**
186
- * Text editor str_replace command for code execution.
344
+ * Schema for a code execution text editor request that replaces one exact string in a file.
345
+ *
346
+ * **When to use**
347
+ *
348
+ * Use when validating or constructing the `str_replace` text editor operation
349
+ * for the 2025-05-22 Anthropic code execution tool.
350
+ *
351
+ * **Gotchas**
352
+ *
353
+ * The `old_str` must match the file contents exactly, including whitespace and
354
+ * indentation, and must identify a single occurrence.
355
+ *
356
+ * @see {@link CodeExecutionTextEditorView} for reading file contents before choosing the replacement text
357
+ * @see {@link CodeExecution_20250522} for the provider-defined tool that consumes this payload
187
358
  *
188
359
  * @category Code Execution
189
360
  * @since 4.0.0
@@ -227,6 +398,13 @@ const CodeExecution_20250522_Parameters = Schema.Union([
227
398
  /**
228
399
  * Schema for the 2025-08-25 code execution tool input, containing the code to execute.
229
400
  *
401
+ * **When to use**
402
+ *
403
+ * Use when validating or constructing the input payload for the 2025-08-25
404
+ * Anthropic code execution tool.
405
+ *
406
+ * @see {@link CodeExecution_20250825} for the provider-defined tool that consumes this schema
407
+ *
230
408
  * @category Code Execution
231
409
  * @since 4.0.0
232
410
  */
@@ -239,6 +417,17 @@ export const CodeExecution_20250825_Parameters = Schema.Struct({
239
417
  /**
240
418
  * Input payload for the 2025-08-25 Anthropic code execution tool.
241
419
  *
420
+ * **When to use**
421
+ *
422
+ * Use when typing input passed to the 2025-08-25 Anthropic code execution tool.
423
+ *
424
+ * **Details**
425
+ *
426
+ * The payload has a single `code` field containing the source code string to
427
+ * execute.
428
+ *
429
+ * @see {@link CodeExecution_20250825} for the provider-defined tool that consumes this payload
430
+ *
242
431
  * @category Code Execution
243
432
  * @since 4.0.0
244
433
  */
@@ -251,12 +440,19 @@ export type CodeExecution_20250825_Parameters = typeof CodeExecution_20250825_Pa
251
440
  /**
252
441
  * Anthropic Code Execution tool (2025-05-22 version).
253
442
  *
443
+ * **When to use**
444
+ *
445
+ * Use when you need the model to execute code in a sandboxed environment and
446
+ * require the 2025-05-22 version of the Anthropic code-execution beta.
447
+ *
254
448
  * **Details**
255
449
  *
256
450
  * Allows the model to execute code in a sandboxed environment with support
257
451
  * for multiple execution types including programmatic tool calls, bash
258
452
  * execution, and text editor operations.
259
453
  *
454
+ * @see {@link CodeExecutionProgrammaticToolCall} for the programmatic tool call schema
455
+ *
260
456
  * @category Code Execution
261
457
  * @since 4.0.0
262
458
  */
@@ -272,9 +468,18 @@ export const CodeExecution_20250522 = Tool.providerDefined({
272
468
  /**
273
469
  * Anthropic Code Execution tool (2025-08-25 version).
274
470
  *
471
+ * **When to use**
472
+ *
473
+ * Use when you need the model to execute code in a sandboxed environment and
474
+ * require the 2025-08-25 version of the Anthropic code-execution beta.
475
+ *
275
476
  * **Details**
276
477
  *
277
- * Allows the model to execute code in a sandboxed environment.
478
+ * Requires the `code-execution-2025-08-25` beta header and uses
479
+ * `CodeExecution_20250825_Parameters` as its input schema.
480
+ *
481
+ * @see {@link CodeExecution_20250522} for the older 2025-05-22 code execution tool
482
+ * @see {@link CodeExecution_20250825_Parameters} for the input schema consumed by this tool
278
483
  *
279
484
  * @category Code Execution
280
485
  * @since 4.0.0
@@ -307,7 +512,16 @@ export const CodeExecution_20250825 = Tool.providerDefined({
307
512
  // -----------------------------------------------------------------------------
308
513
 
309
514
  /**
310
- * An `[x, y]` pixel position.
515
+ * Schema for an `[x, y]` screen coordinate in pixels.
516
+ *
517
+ * **Details**
518
+ *
519
+ * This is a two-number tuple used by computer-use actions that accept screen
520
+ * positions.
521
+ *
522
+ * **Gotchas**
523
+ *
524
+ * This schema validates tuple shape only and does not check display bounds.
311
525
  *
312
526
  * @category Computer Use
313
527
  * @since 4.0.0
@@ -322,7 +536,16 @@ export const Coordinate = Schema.Tuple([Schema.Number, Schema.Number])
322
536
  export type Coordinate = typeof Coordinate.Type
323
537
 
324
538
  /**
325
- * A `[x1, y1, x2, y2]` position defining top-left and bottom-right corners.
539
+ * Schema for an `[x1, y1, x2, y2]` screen region in pixels.
540
+ *
541
+ * **Details**
542
+ *
543
+ * The tuple represents top-left and bottom-right corners.
544
+ *
545
+ * **Gotchas**
546
+ *
547
+ * This schema validates four numbers only and does not check coordinate ordering
548
+ * or display bounds.
326
549
  *
327
550
  * @category Computer Use
328
551
  * @since 4.0.0
@@ -337,7 +560,9 @@ export const Region = Schema.Tuple([Schema.Number, Schema.Number, Schema.Number,
337
560
  export type Region = typeof Region.Type
338
561
 
339
562
  /**
340
- * The direction of the scroll for scroll actions.
563
+ * Scroll direction literal: `"up"`, `"down"`, `"left"`, or `"right"`.
564
+ *
565
+ * @see {@link ComputerUseScrollAction} for the action payload that consumes this schema
341
566
  *
342
567
  * @category Computer Use
343
568
  * @since 4.0.0
@@ -352,14 +577,22 @@ export const ScrollDirection = Schema.Literals(["up", "down", "left", "right"])
352
577
  export type ScrollDirection = typeof ScrollDirection.Type
353
578
 
354
579
  /**
355
- * Modifier keys that can be held during click/scroll actions.
580
+ * Modifier key literal.
581
+ *
582
+ * **Details**
583
+ *
584
+ * Allowed values are `"alt"`, `"ctrl"`, `"meta"`, and `"shift"`.
356
585
  *
357
586
  * @category Computer Use
358
587
  * @since 4.0.0
359
588
  */
360
589
  export const ModifierKey = Schema.Literals(["alt", "ctrl", "meta", "shift"])
361
590
  /**
362
- * Modifier key that can be held during computer-use click or scroll actions.
591
+ * Modifier key literal.
592
+ *
593
+ * **Details**
594
+ *
595
+ * Allowed values are `"alt"`, `"ctrl"`, `"meta"`, and `"shift"`.
363
596
  *
364
597
  * @category Computer Use
365
598
  * @since 4.0.0
@@ -399,7 +632,16 @@ const ComputerUse_20251124_Args = Schema.Struct({
399
632
  // -----------------------------------------------------------------------------
400
633
 
401
634
  /**
402
- * Press a key or key combination (e.g. `"Return"`, `"ctrl+c"`, `"ctrl+s"`).
635
+ * Schema for a computer-use action that presses a key or key combination, such
636
+ * as `"Return"`, `"ctrl+c"`, or `"ctrl+s"`.
637
+ *
638
+ * **When to use**
639
+ *
640
+ * Use when validating or constructing a computer-use action for keyboard
641
+ * shortcuts or non-text key presses.
642
+ *
643
+ * @see {@link TypeAction} for entering ordinary text strings
644
+ * @see {@link ComputerUseHoldKeyAction} for holding a key for a duration
403
645
  *
404
646
  * @category Computer Use
405
647
  * @since 4.0.0
@@ -414,13 +656,43 @@ export const ComputerUseKeyAction = Schema.Struct({
414
656
  /**
415
657
  * Computer-use action payload for pressing a key or key combination.
416
658
  *
659
+ * **Details**
660
+ *
661
+ * The payload uses `action: "key"` and stores the key or key combination to
662
+ * press in `text`, such as `"Return"`, `"ctrl+c"`, or `"ctrl+s"`.
663
+ *
664
+ * **Gotchas**
665
+ *
666
+ * `text` is typed as `string`; the paired schema does not validate
667
+ * provider-specific key names or key combinations.
668
+ *
417
669
  * @category Computer Use
418
670
  * @since 4.0.0
419
671
  */
420
672
  export type ComputerUseKeyAction = typeof ComputerUseKeyAction.Type
421
673
 
422
674
  /**
423
- * Perform a left click at the current mouse position or the specified coordinates.
675
+ * Schema for a computer-use action that performs a left click.
676
+ *
677
+ * **When to use**
678
+ *
679
+ * Use to validate or construct an Anthropic computer-use payload for clicking
680
+ * once at the current mouse position or at a specific screen coordinate.
681
+ *
682
+ * **Details**
683
+ *
684
+ * The encoded payload uses `action: "left_click"`. The optional `coordinate`
685
+ * field supplies the `[x, y]` pixel position; when omitted, the action uses the
686
+ * current mouse position.
687
+ *
688
+ * **Gotchas**
689
+ *
690
+ * The coordinate schema only checks that the value is a two-number tuple. It
691
+ * does not validate that the point falls within the configured display
692
+ * dimensions.
693
+ *
694
+ * @see {@link ComputerUseDoubleClickAction} for performing a double click
695
+ * @see {@link ComputerUseMouseMoveAction} for moving the mouse without clicking
424
696
  *
425
697
  * @category Computer Use
426
698
  * @since 4.0.0
@@ -442,7 +714,24 @@ export const ComputerUseLeftClickAction = Schema.Struct({
442
714
  export type ComputerUseLeftClickAction = typeof ComputerUseLeftClickAction.Type
443
715
 
444
716
  /**
445
- * Move the mouse cursor to the specified coordinates.
717
+ * Schema for a computer-use action that moves the mouse cursor to a required
718
+ * `[x, y]` screen coordinate.
719
+ *
720
+ * **When to use**
721
+ *
722
+ * Use to validate or construct a mouse movement action for an Anthropic
723
+ * computer-use tool call.
724
+ *
725
+ * **Details**
726
+ *
727
+ * The encoded payload has action `"mouse_move"` and a required `coordinate`
728
+ * field containing the target `[x, y]` pixel position.
729
+ *
730
+ * **Gotchas**
731
+ *
732
+ * The coordinate schema only checks that the value is a two-number tuple. It
733
+ * does not validate that the point falls within the configured display
734
+ * dimensions.
446
735
  *
447
736
  * @category Computer Use
448
737
  * @since 4.0.0
@@ -463,7 +752,19 @@ export const ComputerUseMouseMoveAction = Schema.Struct({
463
752
  export type ComputerUseMouseMoveAction = typeof ComputerUseMouseMoveAction.Type
464
753
 
465
754
  /**
466
- * Capture the current display.
755
+ * Schema for a computer-use action that requests a screenshot of the current display.
756
+ *
757
+ * **When to use**
758
+ *
759
+ * Use to validate or construct a computer-use tool action that asks the handler
760
+ * to capture the full current display.
761
+ *
762
+ * **Details**
763
+ *
764
+ * The payload contains only `action: "screenshot"` and does not include
765
+ * coordinates or other options.
766
+ *
767
+ * @see {@link ComputerUseZoomAction} for requesting a zoomed-in screenshot of a specific screen region with the 2025-11-24 computer-use tool
467
768
  *
468
769
  * @category Computer Use
469
770
  * @since 4.0.0
@@ -480,7 +781,19 @@ export const ComputerUseScreenshotAction = Schema.Struct({
480
781
  export type ComputerUseScreenshotAction = typeof ComputerUseScreenshotAction.Type
481
782
 
482
783
  /**
483
- * Type a text string.
784
+ * Schema for a computer-use action that enters text.
785
+ *
786
+ * **When to use**
787
+ *
788
+ * Use to validate or construct a computer-use action for entering ordinary text
789
+ * strings.
790
+ *
791
+ * **Details**
792
+ *
793
+ * The payload uses `action: "type"` and a `text` string containing the text to
794
+ * enter.
795
+ *
796
+ * @see {@link ComputerUseKeyAction} for key presses and keyboard shortcuts
484
797
  *
485
798
  * @category Computer Use
486
799
  * @since 4.0.0
@@ -495,6 +808,11 @@ export const TypeAction = Schema.Struct({
495
808
  /**
496
809
  * Computer-use action payload for typing a text string.
497
810
  *
811
+ * **Details**
812
+ *
813
+ * The payload uses `action: "type"` and a `text` string containing the text to
814
+ * enter.
815
+ *
498
816
  * @category Computer Use
499
817
  * @since 4.0.0
500
818
  */
@@ -513,7 +831,26 @@ const ComputerUse_20241022_Actions = Schema.Union([
513
831
  // -----------------------------------------------------------------------------
514
832
 
515
833
  /**
516
- * Perform a double click.
834
+ * Schema for a computer-use action that performs a double click.
835
+ *
836
+ * **When to use**
837
+ *
838
+ * Use to validate or construct an Anthropic computer-use payload for double
839
+ * clicking at the current mouse position or at a specific screen coordinate.
840
+ *
841
+ * **Details**
842
+ *
843
+ * The encoded payload uses `action: "double_click"`. The optional
844
+ * `coordinate` field supplies the `[x, y]` pixel position; when omitted, the
845
+ * action uses the current mouse position.
846
+ *
847
+ * **Gotchas**
848
+ *
849
+ * The coordinate schema only checks that the value is a two-number tuple. It
850
+ * does not validate that the point falls within the configured display
851
+ * dimensions.
852
+ *
853
+ * @see {@link ComputerUseLeftClickAction} for performing a single left click
517
854
  *
518
855
  * @category Computer Use
519
856
  * @since 4.0.0
@@ -537,6 +874,25 @@ export type ComputerUseDoubleClickAction = typeof ComputerUseDoubleClickAction.T
537
874
  /**
538
875
  * Hold a key for a specified duration during computer-use execution.
539
876
  *
877
+ * **When to use**
878
+ *
879
+ * Use to keep a keyboard key depressed for a fixed number of seconds in a
880
+ * computer-use action sequence.
881
+ *
882
+ * **Details**
883
+ *
884
+ * The schema describes objects with `action: "hold_key"`, a `text` field
885
+ * containing the key to hold, and a `duration` field containing the number of
886
+ * seconds to hold it.
887
+ *
888
+ * **Gotchas**
889
+ *
890
+ * The schema only checks that `duration` is a number; it does not require a
891
+ * positive value.
892
+ *
893
+ * @see {@link ComputerUseKeyAction} for pressing a key or key combination without holding it
894
+ * @see {@link ComputerUseWaitAction} for pausing between actions without holding a key
895
+ *
540
896
  * @category Computer Use
541
897
  * @since 4.0.0
542
898
  */
@@ -554,13 +910,43 @@ export const ComputerUseHoldKeyAction = Schema.Struct({
554
910
  /**
555
911
  * Computer-use action payload for holding a key for a specified duration.
556
912
  *
913
+ * **When to use**
914
+ *
915
+ * Use to represent a key that should remain pressed for a measured interval.
916
+ *
917
+ * **Details**
918
+ *
919
+ * Set `action` to `"hold_key"`, `text` to the key to hold, and `duration` to
920
+ * the number of seconds to hold it.
921
+ *
922
+ * @see {@link ComputerUseKeyAction} for a single key press or key combination without a hold duration
923
+ *
557
924
  * @category Computer Use
558
925
  * @since 4.0.0
559
926
  */
560
927
  export type ComputerUseHoldKeyAction = typeof ComputerUseHoldKeyAction.Type
561
928
 
562
929
  /**
563
- * Click and drag from start coordinate to end coordinate.
930
+ * Schema for a computer-use action that drags with the left mouse button.
931
+ *
932
+ * **When to use**
933
+ *
934
+ * Use to validate or construct an Anthropic computer-use payload for dragging
935
+ * from one screen coordinate to another in a single action.
936
+ *
937
+ * **Details**
938
+ *
939
+ * The encoded payload uses `action: "left_click_drag"` and requires both
940
+ * `start_coordinate` and `coordinate` as `[x, y]` pixel positions.
941
+ *
942
+ * **Gotchas**
943
+ *
944
+ * The coordinate schema only checks that each value is a two-number tuple. It
945
+ * does not validate that either point falls within the configured display
946
+ * dimensions.
947
+ *
948
+ * @see {@link ComputerUseLeftMouseDownAction} for starting a manual drag sequence
949
+ * @see {@link ComputerUseLeftMouseUpAction} for ending a manual drag sequence
564
950
  *
565
951
  * @category Computer Use
566
952
  * @since 4.0.0
@@ -589,7 +975,7 @@ export type ComputerUseLeftClickDragAction = typeof ComputerUseLeftClickDragActi
589
975
  *
590
976
  * **When to use**
591
977
  *
592
- * Use this for fine-grained click control.
978
+ * Use when you use this for fine-grained click control.
593
979
  *
594
980
  * @category Computer Use
595
981
  * @since 4.0.0
@@ -615,7 +1001,7 @@ export type ComputerUseLeftMouseDownAction = typeof ComputerUseLeftMouseDownActi
615
1001
  *
616
1002
  * **When to use**
617
1003
  *
618
- * Use this for fine-grained click control.
1004
+ * Use when you use this for fine-grained click control.
619
1005
  *
620
1006
  * @category Computer Use
621
1007
  * @since 4.0.0
@@ -637,7 +1023,26 @@ export const ComputerUseLeftMouseUpAction = Schema.Struct({
637
1023
  export type ComputerUseLeftMouseUpAction = typeof ComputerUseLeftMouseUpAction.Type
638
1024
 
639
1025
  /**
640
- * Perform a middle click.
1026
+ * Schema for a computer-use action that performs a middle click.
1027
+ *
1028
+ * **When to use**
1029
+ *
1030
+ * Use to validate or construct a middle-button click action for Anthropic
1031
+ * computer use, optionally targeting a specific screen coordinate.
1032
+ *
1033
+ * **Details**
1034
+ *
1035
+ * The payload must use `action: "middle_click"`. When `coordinate` is omitted,
1036
+ * the click occurs at the current mouse position.
1037
+ *
1038
+ * **Gotchas**
1039
+ *
1040
+ * This action is available in the 2025-01-24 computer-use action set and later;
1041
+ * it is not part of `ComputerUse_20241022`.
1042
+ *
1043
+ * @see {@link ComputerUse_20250124} for the provider-defined tool version that first accepts this action
1044
+ * @see {@link ComputerUseLeftClickAction} for primary-button clicks
1045
+ * @see {@link ComputerUseRightClickAction} for secondary-button clicks
641
1046
  *
642
1047
  * @category Computer Use
643
1048
  * @since 4.0.0
@@ -659,7 +1064,22 @@ export const ComputerUseMiddleClickAction = Schema.Struct({
659
1064
  export type ComputerUseMiddleClickAction = typeof ComputerUseMiddleClickAction.Type
660
1065
 
661
1066
  /**
662
- * Perform a right click.
1067
+ * Schema for a computer-use action that performs a right click, optionally at a
1068
+ * specific screen coordinate.
1069
+ *
1070
+ * **When to use**
1071
+ *
1072
+ * Use to validate or construct the `right_click` action for an Anthropic
1073
+ * computer-use tool call.
1074
+ *
1075
+ * **Details**
1076
+ *
1077
+ * The optional `coordinate` field is an `[x, y]` screen coordinate in pixels.
1078
+ * When omitted, the right click is performed at the current mouse position.
1079
+ *
1080
+ * @see {@link ComputerUse_20250124} for the provider-defined computer-use tool version that introduced this action
1081
+ * @see {@link ComputerUseLeftClickAction} for the corresponding left-click action
1082
+ * @see {@link ComputerUseMiddleClickAction} for the corresponding middle-click action
663
1083
  *
664
1084
  * @category Computer Use
665
1085
  * @since 4.0.0
@@ -681,7 +1101,24 @@ export const ComputerUseRightClickAction = Schema.Struct({
681
1101
  export type ComputerUseRightClickAction = typeof ComputerUseRightClickAction.Type
682
1102
 
683
1103
  /**
684
- * Scroll a given amount in a specified direction.
1104
+ * Schema for a computer-use scroll action.
1105
+ *
1106
+ * **When to use**
1107
+ *
1108
+ * Use when validating or constructing Anthropic computer-use scroll payloads.
1109
+ *
1110
+ * **Details**
1111
+ *
1112
+ * The encoded payload uses `action: "scroll"`, an optional `coordinate`,
1113
+ * `scroll_direction`, and `scroll_amount`.
1114
+ *
1115
+ * **Gotchas**
1116
+ *
1117
+ * `coordinate` only checks a two-number tuple, and `scroll_amount` is only
1118
+ * `Schema.Number`.
1119
+ *
1120
+ * @see {@link ComputerUse_20250124} for the tool version that accepts this action
1121
+ * @see {@link ScrollDirection} for the accepted direction literals
685
1122
  *
686
1123
  * @category Computer Use
687
1124
  * @since 4.0.0
@@ -711,7 +1148,26 @@ export const ComputerUseScrollAction = Schema.Struct({
711
1148
  export type ComputerUseScrollAction = typeof ComputerUseScrollAction.Type
712
1149
 
713
1150
  /**
714
- * Perform a triple click.
1151
+ * Schema for a computer-use triple-click action.
1152
+ *
1153
+ * **When to use**
1154
+ *
1155
+ * Use when validating or constructing Anthropic computer-use triple-click
1156
+ * payloads at the current pointer position or an optional coordinate.
1157
+ *
1158
+ * **Details**
1159
+ *
1160
+ * The encoded payload uses `action: "triple_click"` and an optional
1161
+ * `coordinate`.
1162
+ *
1163
+ * **Gotchas**
1164
+ *
1165
+ * `coordinate` only validates as a two-number tuple and does not check display
1166
+ * bounds.
1167
+ *
1168
+ * @see {@link ComputerUse_20250124} for the tool version that accepts this action
1169
+ * @see {@link ComputerUseDoubleClickAction} for the two-click variant
1170
+ * @see {@link ComputerUseLeftClickAction} for a single left click
715
1171
  *
716
1172
  * @category Computer Use
717
1173
  * @since 4.0.0
@@ -733,7 +1189,25 @@ export const ComputerUseTripleClickAction = Schema.Struct({
733
1189
  export type ComputerUseTripleClickAction = typeof ComputerUseTripleClickAction.Type
734
1190
 
735
1191
  /**
736
- * Pause between performing actions.
1192
+ * Schema for a computer-use wait action.
1193
+ *
1194
+ * **When to use**
1195
+ *
1196
+ * Use when validating or constructing Anthropic computer-use payloads that pause
1197
+ * between actions.
1198
+ *
1199
+ * **Details**
1200
+ *
1201
+ * The encoded payload uses `action: "wait"` and a required `duration` in
1202
+ * seconds.
1203
+ *
1204
+ * **Gotchas**
1205
+ *
1206
+ * `duration` is only `Schema.Number`; it is not constrained to positive or
1207
+ * finite values.
1208
+ *
1209
+ * @see {@link ComputerUseHoldKeyAction} for another duration-based computer-use action
1210
+ * @see {@link ComputerUse_20250124} for the tool version that accepts this action
737
1211
  *
738
1212
  * @category Computer Use
739
1213
  * @since 4.0.0
@@ -776,7 +1250,15 @@ const ComputerUse_20250124_Actions = Schema.Union([
776
1250
  *
777
1251
  * **Details**
778
1252
  *
779
- * Requires `enableZoom: true` in the tool definition.
1253
+ * The encoded payload uses `action: "zoom"` and a `region` tuple.
1254
+ *
1255
+ * **Gotchas**
1256
+ *
1257
+ * Requires `enableZoom: true` in the tool definition. `region` is only a
1258
+ * four-number tuple and does not validate corner ordering or display bounds.
1259
+ *
1260
+ * @see {@link ComputerUse_20251124} for the tool version that accepts this action
1261
+ * @see {@link ComputerUseScreenshotAction} for capturing the full screen instead
780
1262
  *
781
1263
  * @category Computer Use
782
1264
  * @since 4.0.0
@@ -792,9 +1274,11 @@ export const ComputerUseZoomAction = Schema.Struct({
792
1274
  /**
793
1275
  * Computer-use action payload for zooming into a specific screen region.
794
1276
  *
795
- * **Details**
1277
+ * **Gotchas**
796
1278
  *
797
1279
  * The enclosing computer-use tool must be configured with `enableZoom: true`.
1280
+ * `region` is only a four-number tuple and does not validate corner ordering or
1281
+ * display bounds.
798
1282
  *
799
1283
  * @category Computer Use
800
1284
  * @since 4.0.0
@@ -834,6 +1318,11 @@ export const ComputerUse_20241022 = Tool.providerDefined({
834
1318
  /**
835
1319
  * Computer use tool for Claude 4 models and Claude Sonnet 3.7.
836
1320
  *
1321
+ * **When to use**
1322
+ *
1323
+ * Use when configuring Anthropic computer use for Claude 4 models or Claude
1324
+ * Sonnet 3.7 with the 2025-01-24 action set.
1325
+ *
837
1326
  * **Details**
838
1327
  *
839
1328
  * Requires the "computer-use-2025-01-24" beta header.
@@ -841,6 +1330,9 @@ export const ComputerUse_20241022 = Tool.providerDefined({
841
1330
  * right_click, middle_click, double_click, triple_click, left_mouse_down,
842
1331
  * left_mouse_up, hold_key, wait.
843
1332
  *
1333
+ * @see {@link ComputerUse_20241022} for the older basic action set
1334
+ * @see {@link ComputerUse_20251124} for the newer zoom-capable version
1335
+ *
844
1336
  * @category Computer Use
845
1337
  * @since 4.0.0
846
1338
  */
@@ -857,11 +1349,23 @@ export const ComputerUse_20250124 = Tool.providerDefined({
857
1349
  /**
858
1350
  * Computer use tool for Claude Opus 4.5 only.
859
1351
  *
1352
+ * **When to use**
1353
+ *
1354
+ * Use when configuring Anthropic computer use for Claude Opus 4.5 with the
1355
+ * 2025-11-24 action set and zoom-capable screen inspection.
1356
+ *
860
1357
  * **Details**
861
1358
  *
862
1359
  * Requires the "computer-use-2025-11-24" beta header.
863
1360
  * Includes all actions from computer_20250124 plus the zoom action for
864
- * detailed screen region inspection. Requires `enableZoom: true` in args.
1361
+ * detailed screen region inspection.
1362
+ *
1363
+ * **Gotchas**
1364
+ *
1365
+ * Zoom actions require `enableZoom: true` in args.
1366
+ *
1367
+ * @see {@link ComputerUse_20250124} for the previous action set without zoom
1368
+ * @see {@link ComputerUseZoomAction} for the zoom action payload
865
1369
  *
866
1370
  * @category Computer Use
867
1371
  * @since 4.0.0
@@ -887,12 +1391,20 @@ export const ComputerUse_20251124 = Tool.providerDefined({
887
1391
  /**
888
1392
  * A `[start, end]` line range for viewing file contents.
889
1393
  *
1394
+ * **When to use**
1395
+ *
1396
+ * Use when constructing or validating `view_range` for memory or text editor
1397
+ * view commands.
1398
+ *
890
1399
  * **Details**
891
1400
  *
892
- * Lines are 1-indexed. Use -1 for end to read to the end of the file. For
1401
+ * Lines are 1-indexed. Use `-1` for end to read to the end of the file. For
893
1402
  * example, `[1, 50]` views lines 1-50 and `[100, -1]` views from line 100 to
894
1403
  * the end of the file.
895
1404
  *
1405
+ * @see {@link MemoryViewCommand} for memory view payloads that use this range
1406
+ * @see {@link TextEditorViewCommand} for text editor view payloads that use this range
1407
+ *
896
1408
  * @category Memory
897
1409
  * @since 4.0.0
898
1410
  */
@@ -900,6 +1412,10 @@ export const ViewRange = Schema.Tuple([Schema.Number, Schema.Number])
900
1412
  /**
901
1413
  * A `[start, end]` 1-indexed line range for viewing file contents, using `-1` as the end value to read through the end of the file.
902
1414
  *
1415
+ * **When to use**
1416
+ *
1417
+ * Use when typing `view_range` for memory or text editor view commands.
1418
+ *
903
1419
  * @category Memory
904
1420
  * @since 4.0.0
905
1421
  */
@@ -910,7 +1426,11 @@ export type ViewRange = typeof ViewRange.Type
910
1426
  // -----------------------------------------------------------------------------
911
1427
 
912
1428
  /**
913
- * Creates a new file.
1429
+ * Schema for the memory tool command that creates a new file at a path.
1430
+ *
1431
+ * **Details**
1432
+ *
1433
+ * The payload contains `command: "create"` and a `path` string.
914
1434
  *
915
1435
  * @category Memory
916
1436
  * @since 4.0.0
@@ -931,7 +1451,7 @@ export const MemoryCreateCommand = Schema.Struct({
931
1451
  export type MemoryCreateCommand = typeof MemoryCreateCommand.Type
932
1452
 
933
1453
  /**
934
- * Delete a file or directory.
1454
+ * Schema for a memory command that deletes a file or directory.
935
1455
  *
936
1456
  * @category Memory
937
1457
  * @since 4.0.0
@@ -939,7 +1459,7 @@ export type MemoryCreateCommand = typeof MemoryCreateCommand.Type
939
1459
  export const MemoryDeleteCommand = Schema.Struct({
940
1460
  command: Schema.Literal("delete"),
941
1461
  /**
942
- * The path to the file to delete.
1462
+ * The path to the file or directory to delete.
943
1463
  */
944
1464
  path: Schema.String
945
1465
  })
@@ -952,7 +1472,19 @@ export const MemoryDeleteCommand = Schema.Struct({
952
1472
  export type MemoryDeleteCommand = typeof MemoryDeleteCommand.Type
953
1473
 
954
1474
  /**
955
- * Insert text at a specific line.
1475
+ * Schema for the memory `insert` command.
1476
+ *
1477
+ * **When to use**
1478
+ *
1479
+ * Use when validating or constructing `insert` payloads for `Memory_20250818`.
1480
+ *
1481
+ * **Details**
1482
+ *
1483
+ * The payload is discriminated by `command: "insert"` and requires `path`,
1484
+ * `insert_line`, and `insert_text`.
1485
+ *
1486
+ * @see {@link Memory_20250818} for the provider-defined tool that consumes this command
1487
+ * @see {@link MemoryStrReplaceCommand} for replacing existing text instead
956
1488
  *
957
1489
  * @category Memory
958
1490
  * @since 4.0.0
@@ -981,7 +1513,12 @@ export const MemoryInsertCommand = Schema.Struct({
981
1513
  export type MemoryInsertCommand = typeof MemoryInsertCommand.Type
982
1514
 
983
1515
  /**
984
- * Rename or move a file or directory.
1516
+ * Schema for the memory command that renames or moves a file or directory.
1517
+ *
1518
+ * **Details**
1519
+ *
1520
+ * The payload uses `command: "rename"` and requires `old_path` as the current
1521
+ * path plus `new_path` as the new destination path.
985
1522
  *
986
1523
  * @category Memory
987
1524
  * @since 4.0.0
@@ -1006,7 +1543,19 @@ export const MemoryRenameCommand = Schema.Struct({
1006
1543
  export type MemoryRenameCommand = typeof MemoryRenameCommand.Type
1007
1544
 
1008
1545
  /**
1009
- * Replace text in a file.
1546
+ * Schema for the memory `str_replace` command.
1547
+ *
1548
+ * **When to use**
1549
+ *
1550
+ * Use when validating or constructing `str_replace` payloads for
1551
+ * `Memory_20250818`.
1552
+ *
1553
+ * **Details**
1554
+ *
1555
+ * The payload is discriminated by `command: "str_replace"` and requires `path`,
1556
+ * `old_str`, and `new_str`.
1557
+ *
1558
+ * @see {@link Memory_20250818} for the provider-defined tool that consumes this command
1010
1559
  *
1011
1560
  * @category Memory
1012
1561
  * @since 4.0.0
@@ -1037,13 +1586,18 @@ export type MemoryStrReplaceCommand = typeof MemoryStrReplaceCommand.Type
1037
1586
  /**
1038
1587
  * Shows directory contents or file contents with optional line ranges.
1039
1588
  *
1589
+ * **Details**
1590
+ *
1591
+ * When used on a file, returns file contents optionally limited by `view_range`.
1592
+ * When used on a directory, lists contents.
1593
+ *
1040
1594
  * @category Memory
1041
1595
  * @since 4.0.0
1042
1596
  */
1043
1597
  export const MemoryViewCommand = Schema.Struct({
1044
1598
  command: Schema.Literal("view"),
1045
1599
  /**
1046
- * The path to the file to view.
1600
+ * The path to the file or directory to view.
1047
1601
  */
1048
1602
  path: Schema.String,
1049
1603
  /**
@@ -1102,10 +1656,19 @@ export const Memory_20250818 = Tool.providerDefined({
1102
1656
  /**
1103
1657
  * View the contents of a file or list directory contents.
1104
1658
  *
1659
+ * **When to use**
1660
+ *
1661
+ * Use when validating or constructing the standalone Anthropic Text Editor
1662
+ * `view` command.
1663
+ *
1105
1664
  * **Details**
1106
1665
  *
1107
1666
  * When used on a file, returns the file contents, optionally limited to a line
1108
1667
  * range. When used on a directory, lists all files and subdirectories.
1668
+ * `view_range` is a 1-indexed `[start, end]` tuple where `-1` means through
1669
+ * the end of the file.
1670
+ *
1671
+ * @see {@link CodeExecutionTextEditorView} for the code-execution variant without `view_range`
1109
1672
  *
1110
1673
  * @category Text Editor
1111
1674
  * @since 4.0.0
@@ -1125,6 +1688,11 @@ export const TextEditorViewCommand = Schema.Struct({
1125
1688
  /**
1126
1689
  * Text editor command payload for viewing file contents or listing directory contents.
1127
1690
  *
1691
+ * **Details**
1692
+ *
1693
+ * `view_range` is a 1-indexed `[start, end]` tuple where `-1` means through
1694
+ * the end of the file.
1695
+ *
1128
1696
  * @category Text Editor
1129
1697
  * @since 4.0.0
1130
1698
  */
@@ -1133,6 +1701,16 @@ export type TextEditorViewCommand = typeof TextEditorViewCommand.Type
1133
1701
  /**
1134
1702
  * Create a new file with specified content.
1135
1703
  *
1704
+ * **When to use**
1705
+ *
1706
+ * Use when validating or constructing an Anthropic text editor `create`
1707
+ * command.
1708
+ *
1709
+ * **Details**
1710
+ *
1711
+ * The payload is discriminated by `command: "create"` and requires both `path`
1712
+ * and `file_text`.
1713
+ *
1136
1714
  * **Gotchas**
1137
1715
  *
1138
1716
  * Fails if the file already exists. Parent directories must exist.
@@ -1166,11 +1744,24 @@ export type TextEditorCreateCommand = typeof TextEditorCreateCommand.Type
1166
1744
  /**
1167
1745
  * Replace a specific string in a file with a new string.
1168
1746
  *
1747
+ * **When to use**
1748
+ *
1749
+ * Use when validating or constructing standalone Anthropic text editor
1750
+ * `str_replace` commands.
1751
+ *
1752
+ * **Details**
1753
+ *
1754
+ * The payload uses `command: "str_replace"`, `path`, `old_str`, and `new_str`.
1755
+ * `new_str` may be empty to delete text.
1756
+ *
1169
1757
  * **Gotchas**
1170
1758
  *
1171
1759
  * The `old_str` must match exactly (including whitespace and indentation)
1172
1760
  * and must be unique in the file.
1173
1761
  *
1762
+ * @see {@link TextEditorViewCommand} for reading contents before choosing `old_str`
1763
+ * @see {@link CodeExecutionTextEditorStrReplace} for the code-execution variant
1764
+ *
1174
1765
  * @category Text Editor
1175
1766
  * @since 4.0.0
1176
1767
  */
@@ -1192,6 +1783,11 @@ export const TextEditorStrReplaceCommand = Schema.Struct({
1192
1783
  /**
1193
1784
  * Text editor command payload for replacing one exact, unique string in a file.
1194
1785
  *
1786
+ * **Gotchas**
1787
+ *
1788
+ * The `old_str` must match exactly, including whitespace and indentation, and
1789
+ * must be unique in the file.
1790
+ *
1195
1791
  * @category Text Editor
1196
1792
  * @since 4.0.0
1197
1793
  */
@@ -1202,7 +1798,8 @@ export type TextEditorStrReplaceCommand = typeof TextEditorStrReplaceCommand.Typ
1202
1798
  *
1203
1799
  * **Details**
1204
1800
  *
1205
- * Inserts the new text AFTER the specified line number.
1801
+ * Inserts the new text after the specified line number. Use `0` to insert at
1802
+ * the beginning of the file; other values are 1-indexed.
1206
1803
  *
1207
1804
  * @category Text Editor
1208
1805
  * @since 4.0.0
@@ -1235,12 +1832,14 @@ export type TextEditorInsertCommand = typeof TextEditorInsertCommand.Type
1235
1832
  *
1236
1833
  * **Details**
1237
1834
  *
1238
- * Reverts the most recent str_replace, insert, or create operation on the file.
1835
+ * Reverts the most recent `str_replace`, `insert`, or `create` operation on the
1836
+ * file.
1239
1837
  *
1240
1838
  * **Gotchas**
1241
1839
  *
1242
- * This command is available in text_editor_20241022 and text_editor_20250124,
1243
- * but not in text_editor_20250728 (Claude 4 models).
1840
+ * This command is available in `text_editor_20241022` and
1841
+ * `text_editor_20250124`, but not in `text_editor_20250429` or
1842
+ * `text_editor_20250728`.
1244
1843
  *
1245
1844
  * @category Text Editor
1246
1845
  * @since 4.0.0
@@ -1257,7 +1856,8 @@ export const TextEditorUndoEditCommand = Schema.Struct({
1257
1856
  *
1258
1857
  * **Gotchas**
1259
1858
  *
1260
- * Available for `text_editor_20241022` and `text_editor_20250124`, but not for Claude 4 text editor versions.
1859
+ * Available for `text_editor_20241022` and `text_editor_20250124`, but not for
1860
+ * `text_editor_20250429` or `text_editor_20250728`.
1261
1861
  *
1262
1862
  * @category Text Editor
1263
1863
  * @since 4.0.0
@@ -1298,9 +1898,18 @@ const TextEditor_StrReplaceBasedEdit_Args = Schema.Struct({
1298
1898
  /**
1299
1899
  * Text editor tool for Claude 3.5 Sonnet (deprecated).
1300
1900
  *
1901
+ * **When to use**
1902
+ *
1903
+ * Use when configuring the 2024-10-22 `str_replace_editor` compatibility path
1904
+ * for Claude 3.5 Sonnet.
1905
+ *
1301
1906
  * **Details**
1302
1907
  *
1303
- * Requires the "computer-use-2024-10-22" beta header.
1908
+ * Requires the "computer-use-2024-10-22" beta header and supports `view`,
1909
+ * `create`, `str_replace`, `insert`, and `undo_edit` commands.
1910
+ *
1911
+ * @see {@link TextEditor_20250124} for the newer `str_replace_editor` version
1912
+ * @see {@link TextEditor_20250728} for the Claude 4 `str_replace_based_edit_tool` line
1304
1913
  *
1305
1914
  * @category Text Editor
1306
1915
  * @since 4.0.0
@@ -1317,9 +1926,18 @@ export const TextEditor_20241022 = Tool.providerDefined({
1317
1926
  /**
1318
1927
  * Text editor tool for Claude Sonnet 3.7 (deprecated model).
1319
1928
  *
1929
+ * **When to use**
1930
+ *
1931
+ * Use when configuring the 2025-01-24 Claude Sonnet 3.7 text editor tool using
1932
+ * `str_replace_editor`.
1933
+ *
1320
1934
  * **Details**
1321
1935
  *
1322
- * Requires the "computer-use-2025-01-24" beta header.
1936
+ * Requires the "computer-use-2025-01-24" beta header, requires a handler, and
1937
+ * supports `view`, `create`, `str_replace`, `insert`, and `undo_edit` commands.
1938
+ *
1939
+ * @see {@link TextEditor_20241022} for the older `str_replace_editor` version
1940
+ * @see {@link TextEditor_20250429} for the Claude 4 `str_replace_based_edit_tool` line
1323
1941
  *
1324
1942
  * @category Text Editor
1325
1943
  * @since 4.0.0
@@ -1336,6 +1954,11 @@ export const TextEditor_20250124 = Tool.providerDefined({
1336
1954
  /**
1337
1955
  * Text editor tool for Claude 4 models using Anthropic's `str_replace_based_edit_tool`.
1338
1956
  *
1957
+ * **When to use**
1958
+ *
1959
+ * Use when configuring the 2025-04-29 Claude 4 `str_replace_based_edit_tool`
1960
+ * version.
1961
+ *
1339
1962
  * **Details**
1340
1963
  *
1341
1964
  * Requires the "computer-use-2025-01-24" beta header.
@@ -1344,6 +1967,9 @@ export const TextEditor_20250124 = Tool.providerDefined({
1344
1967
  *
1345
1968
  * This version does not support the `undo_edit` command.
1346
1969
  *
1970
+ * @see {@link TextEditor_20250124} for the previous `str_replace_editor` version
1971
+ * @see {@link TextEditor_20250728} for the later Claude 4 text editor version
1972
+ *
1347
1973
  * @category Text Editor
1348
1974
  * @since 4.0.0
1349
1975
  */
@@ -1360,6 +1986,11 @@ export const TextEditor_20250429 = Tool.providerDefined({
1360
1986
  /**
1361
1987
  * Text editor tool for Claude 4 models.
1362
1988
  *
1989
+ * **Details**
1990
+ *
1991
+ * Uses Anthropic's `str_replace_based_edit_tool`. `max_characters` can limit
1992
+ * file-view output for this version.
1993
+ *
1363
1994
  * **Gotchas**
1364
1995
  *
1365
1996
  * This version does not support the `undo_edit` command.
@@ -1390,8 +2021,16 @@ export const TextEditor_20250728 = Tool.providerDefined({
1390
2021
  *
1391
2022
  * **When to use**
1392
2023
  *
1393
- * Providing location helps return more relevant results for location-dependent
1394
- * queries like weather, local businesses, events, etc.
2024
+ * Use when providing location helps return more relevant results for
2025
+ * location-dependent queries like weather, local businesses, or events.
2026
+ *
2027
+ * **Details**
2028
+ *
2029
+ * The schema uses `type: "approximate"` plus optional `city`, `region`,
2030
+ * `country`, and `timezone`. `country` is an ISO 3166-1 alpha-2 code, and
2031
+ * `timezone` is an IANA time zone identifier.
2032
+ *
2033
+ * @see {@link WebSearch_20250305_Args} for the argument schema that consumes this location
1395
2034
  *
1396
2035
  * @category Web Search
1397
2036
  * @since 4.0.0
@@ -1426,6 +2065,23 @@ export const WebSearchUserLocation = Schema.Struct({
1426
2065
  /**
1427
2066
  * Configuration arguments for the web search tool.
1428
2067
  *
2068
+ * **When to use**
2069
+ *
2070
+ * Use when configuring `WebSearch_20250305` with search limits, domain filters,
2071
+ * or user location.
2072
+ *
2073
+ * **Details**
2074
+ *
2075
+ * The payload can set `maxUses`, `allowedDomains`, `blockedDomains`, and
2076
+ * `userLocation`.
2077
+ *
2078
+ * **Gotchas**
2079
+ *
2080
+ * `allowedDomains` and `blockedDomains` are mutually exclusive.
2081
+ *
2082
+ * @see {@link WebSearch_20250305} for the provider-defined tool that consumes these arguments
2083
+ * @see {@link WebSearchUserLocation} for localizing search results
2084
+ *
1429
2085
  * @category Web Search
1430
2086
  * @since 4.0.0
1431
2087
  */
@@ -1454,6 +2110,10 @@ export const WebSearch_20250305_Args = Schema.Struct({
1454
2110
  /**
1455
2111
  * Configuration arguments for the Anthropic web search tool, including usage limits, domain filters, and optional user location.
1456
2112
  *
2113
+ * **Gotchas**
2114
+ *
2115
+ * `allowedDomains` and `blockedDomains` are mutually exclusive.
2116
+ *
1457
2117
  * @category Web Search
1458
2118
  * @since 4.0.0
1459
2119
  */
@@ -1464,7 +2124,14 @@ export type WebSearch_20250305_Args = typeof WebSearch_20250305_Args.Type
1464
2124
  // -----------------------------------------------------------------------------
1465
2125
 
1466
2126
  /**
1467
- * Input parameters for a web search.
2127
+ * Schema for Claude-supplied web search tool parameters.
2128
+ *
2129
+ * **Details**
2130
+ *
2131
+ * The payload contains the generated `query` string and is consumed by
2132
+ * `WebSearch_20250305`.
2133
+ *
2134
+ * @see {@link WebSearch_20250305} for the provider-defined tool that consumes this payload
1468
2135
  *
1469
2136
  * @category Web Search
1470
2137
  * @since 4.0.0
@@ -1482,6 +2149,8 @@ export const WebSearchParameters = Schema.Struct({
1482
2149
  *
1483
2150
  * Contains the generated search query used by `WebSearch_20250305`.
1484
2151
  *
2152
+ * @see {@link WebSearch_20250305} for the provider-defined tool that consumes this payload
2153
+ *
1485
2154
  * @category Web Search
1486
2155
  * @since 4.0.0
1487
2156
  */
@@ -1494,12 +2163,18 @@ export type WebSearchParameters = typeof WebSearchParameters.Type
1494
2163
  /**
1495
2164
  * Web search tool for Claude models.
1496
2165
  *
2166
+ * **When to use**
2167
+ *
2168
+ * Use when Claude should search the web for real-time information.
2169
+ *
1497
2170
  * **Details**
1498
2171
  *
1499
2172
  * Enables Claude to search the web for real-time information. This is a
1500
2173
  * server-side tool executed by Anthropic's infrastructure.
1501
2174
  * Generally available (no beta header required).
1502
2175
  *
2176
+ * @see {@link WebFetch_20250910} for retrieving known URLs after discovery
2177
+ *
1503
2178
  * @category Web Search
1504
2179
  * @since 4.0.0
1505
2180
  */
@@ -1524,6 +2199,17 @@ export const WebSearch_20250305 = Tool.providerDefined({
1524
2199
  /**
1525
2200
  * Citation configuration for web fetch.
1526
2201
  *
2202
+ * **When to use**
2203
+ *
2204
+ * Use when configuring whether web fetch results should include citations.
2205
+ *
2206
+ * **Details**
2207
+ *
2208
+ * The payload contains the `enabled` flag. `citations` is optional on
2209
+ * `WebFetch_20250910_Args`, and citations are disabled by default.
2210
+ *
2211
+ * @see {@link WebFetch_20250910_Args} for the argument schema that consumes this configuration
2212
+ *
1527
2213
  * @category Web Fetch
1528
2214
  * @since 4.0.0
1529
2215
  */
@@ -1536,6 +2222,13 @@ export const WebFetchCitationsConfig = Schema.Struct({
1536
2222
  /**
1537
2223
  * Configuration payload for enabling or disabling citations on web fetch results.
1538
2224
  *
2225
+ * **Details**
2226
+ *
2227
+ * The payload contains the `enabled` flag. `citations` is optional on
2228
+ * `WebFetch_20250910_Args`, and citations are disabled by default.
2229
+ *
2230
+ * @see {@link WebFetch_20250910_Args} for the argument schema that consumes this configuration
2231
+ *
1539
2232
  * @category Web Fetch
1540
2233
  * @since 4.0.0
1541
2234
  */
@@ -1548,6 +2241,25 @@ export type WebFetchCitationsConfig = typeof WebFetchCitationsConfig.Type
1548
2241
  /**
1549
2242
  * Configuration arguments for the web fetch tool.
1550
2243
  *
2244
+ * **When to use**
2245
+ *
2246
+ * Use when configuring `WebFetch_20250910` with usage limits, domain filters,
2247
+ * citations, or content token limits.
2248
+ *
2249
+ * **Details**
2250
+ *
2251
+ * The payload can set `maxUses`, domain filters, `citations`, and
2252
+ * `maxContentTokens`, which map to Anthropic web fetch request fields.
2253
+ *
2254
+ * **Gotchas**
2255
+ *
2256
+ * `allowedDomains` and `blockedDomains` are mutually exclusive.
2257
+ * `maxContentTokens` is approximate and does not apply to binary content such
2258
+ * as PDFs.
2259
+ *
2260
+ * @see {@link WebFetch_20250910} for the provider-defined tool that consumes these arguments
2261
+ * @see {@link WebFetchCitationsConfig} for configuring citations
2262
+ *
1551
2263
  * @category Web Fetch
1552
2264
  * @since 4.0.0
1553
2265
  */
@@ -1580,6 +2292,12 @@ export const WebFetch_20250910_Args = Schema.Struct({
1580
2292
  /**
1581
2293
  * Configuration arguments for the Anthropic web fetch tool, including usage limits, domain filters, citation settings, and token limits.
1582
2294
  *
2295
+ * **Gotchas**
2296
+ *
2297
+ * `allowedDomains` and `blockedDomains` are mutually exclusive.
2298
+ * `maxContentTokens` is approximate and does not apply to binary content such
2299
+ * as PDFs.
2300
+ *
1583
2301
  * @category Web Fetch
1584
2302
  * @since 4.0.0
1585
2303
  */
@@ -1590,7 +2308,23 @@ export type WebFetch_20250910_Args = typeof WebFetch_20250910_Args.Type
1590
2308
  // -----------------------------------------------------------------------------
1591
2309
 
1592
2310
  /**
1593
- * Input parameters for a web fetch.
2311
+ * Schema for Claude-supplied web fetch parameters.
2312
+ *
2313
+ * **When to use**
2314
+ *
2315
+ * Use when validating or constructing the `url` payload consumed by
2316
+ * `WebFetch_20250910`.
2317
+ *
2318
+ * **Details**
2319
+ *
2320
+ * The payload contains the single `url` parameter for Anthropic web fetch.
2321
+ *
2322
+ * **Gotchas**
2323
+ *
2324
+ * The URL must be user-provided or from prior search/fetch results. Maximum URL
2325
+ * length is 250 characters.
2326
+ *
2327
+ * @see {@link WebFetch_20250910} for the provider-defined tool that consumes this payload
1594
2328
  *
1595
2329
  * @category Web Fetch
1596
2330
  * @since 4.0.0
@@ -1605,6 +2339,15 @@ export const WebFetchParameters = Schema.Struct({
1605
2339
  /**
1606
2340
  * Type of the parameters Claude supplies when invoking the Anthropic web fetch tool.
1607
2341
  *
2342
+ * **Details**
2343
+ *
2344
+ * The payload contains the single `url` parameter for Anthropic web fetch.
2345
+ *
2346
+ * **Gotchas**
2347
+ *
2348
+ * The URL must be user-provided or from prior search/fetch results. Maximum URL
2349
+ * length is 250 characters.
2350
+ *
1608
2351
  * @category Web Fetch
1609
2352
  * @since 4.0.0
1610
2353
  */
@@ -1617,11 +2360,17 @@ export type WebFetchParameters = typeof WebFetchParameters.Type
1617
2360
  /**
1618
2361
  * Web fetch tool for Claude models.
1619
2362
  *
2363
+ * **When to use**
2364
+ *
2365
+ * Use when Claude should retrieve the content of a specific web page or PDF.
2366
+ *
1620
2367
  * **Details**
1621
2368
  *
1622
2369
  * Allows Claude to retrieve full content from web pages and PDF documents.
1623
- * This is a server-side tool executed by Anthropic's infrastructure.
1624
- * Requires the "web-fetch-2025-09-10" beta header.
2370
+ * This is a server-side tool executed by Anthropic's infrastructure. Selecting
2371
+ * this tool adds the "web-fetch-2025-09-10" beta header.
2372
+ *
2373
+ * @see {@link WebSearch_20250305} for discovering URLs before fetching specific content
1625
2374
  *
1626
2375
  * @category Web Fetch
1627
2376
  * @since 4.0.0
@@ -1664,6 +2413,11 @@ export const ToolSearchRegexParameters = Schema.Struct({
1664
2413
  /**
1665
2414
  * Type of the parameters Claude supplies when invoking regex-based Anthropic tool search.
1666
2415
  *
2416
+ * **Details**
2417
+ *
2418
+ * Claude constructs regex patterns using Python's `re.search()` syntax.
2419
+ * Maximum query length: 200 characters.
2420
+ *
1667
2421
  * @category Tool Search
1668
2422
  * @since 4.0.0
1669
2423
  */
@@ -1672,6 +2426,18 @@ export type ToolSearchRegexParameters = typeof ToolSearchRegexParameters.Type
1672
2426
  /**
1673
2427
  * Input parameters for BM25/natural language tool search.
1674
2428
  *
2429
+ * **When to use**
2430
+ *
2431
+ * Use when validating or constructing the natural-language query payload for
2432
+ * `ToolSearchBM25_20251119`.
2433
+ *
2434
+ * **Details**
2435
+ *
2436
+ * The payload contains Claude's natural-language `query`. BM25 searches tool
2437
+ * names, descriptions, argument names, and argument descriptions.
2438
+ *
2439
+ * @see {@link ToolSearchBM25_20251119} for the provider-defined tool that consumes these parameters
2440
+ *
1675
2441
  * @category Tool Search
1676
2442
  * @since 4.0.0
1677
2443
  */
@@ -1718,6 +2484,11 @@ export const ToolSearchRegex_20251119 = Tool.providerDefined({
1718
2484
  /**
1719
2485
  * BM25/natural language tool search for Claude models.
1720
2486
  *
2487
+ * **When to use**
2488
+ *
2489
+ * Use when you want Claude to find relevant tools from a natural-language query
2490
+ * instead of a regex pattern.
2491
+ *
1721
2492
  * **Details**
1722
2493
  *
1723
2494
  * Claude uses natural language queries to search for tools using the
@@ -1725,6 +2496,8 @@ export const ToolSearchRegex_20251119 = Tool.providerDefined({
1725
2496
  * argument names, and argument descriptions.
1726
2497
  * Requires the "advanced-tool-use-2025-11-20" beta header.
1727
2498
  *
2499
+ * @see {@link ToolSearchRegex_20251119} for the regex-pattern alternative
2500
+ *
1728
2501
  * @category Tool Search
1729
2502
  * @since 4.0.0
1730
2503
  */