@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.
- package/dist/AnthropicClient.d.ts +49 -0
- package/dist/AnthropicClient.d.ts.map +1 -1
- package/dist/AnthropicClient.js +63 -3
- package/dist/AnthropicClient.js.map +1 -1
- package/dist/AnthropicConfig.d.ts +22 -0
- package/dist/AnthropicConfig.d.ts.map +1 -1
- package/dist/AnthropicConfig.js +12 -0
- package/dist/AnthropicConfig.js.map +1 -1
- package/dist/AnthropicError.d.ts +8 -0
- package/dist/AnthropicError.d.ts.map +1 -1
- package/dist/AnthropicLanguageModel.d.ts +104 -6
- package/dist/AnthropicLanguageModel.d.ts.map +1 -1
- package/dist/AnthropicLanguageModel.js +53 -3
- package/dist/AnthropicLanguageModel.js.map +1 -1
- package/dist/AnthropicTelemetry.d.ts +21 -1
- package/dist/AnthropicTelemetry.d.ts.map +1 -1
- package/dist/AnthropicTelemetry.js +38 -4
- package/dist/AnthropicTelemetry.js.map +1 -1
- package/dist/AnthropicTool.d.ts +829 -56
- package/dist/AnthropicTool.d.ts.map +1 -1
- package/dist/AnthropicTool.js +683 -48
- package/dist/AnthropicTool.js.map +1 -1
- package/dist/index.d.ts +0 -65
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -65
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/src/AnthropicClient.ts +78 -3
- package/src/AnthropicConfig.ts +22 -0
- package/src/AnthropicError.ts +8 -0
- package/src/AnthropicLanguageModel.ts +133 -7
- package/src/AnthropicTelemetry.ts +54 -5
- package/src/AnthropicTool.ts +827 -54
- package/src/index.ts +0 -65
package/dist/AnthropicTool.js
CHANGED
|
@@ -1,8 +1,58 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Anthropic provider
|
|
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
|
-
*
|
|
5
|
-
*
|
|
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
|
*/
|
|
@@ -15,11 +65,18 @@ import * as Generated from "./Generated.js";
|
|
|
15
65
|
/**
|
|
16
66
|
* Anthropic Bash tool (2024-10-22 version).
|
|
17
67
|
*
|
|
68
|
+
* **When to use**
|
|
69
|
+
*
|
|
70
|
+
* Use when you need the model to execute bash commands and require the 2024-10-22
|
|
71
|
+
* version of the Anthropic computer-use beta.
|
|
72
|
+
*
|
|
18
73
|
* **Details**
|
|
19
74
|
*
|
|
20
75
|
* Allows the model to execute bash commands in a sandboxed environment.
|
|
21
76
|
* Requires the "computer-use-2024-10-22" beta header.
|
|
22
77
|
*
|
|
78
|
+
* @see {@link Bash_20250124} for the newer 2025-01-24 version of the bash tool
|
|
79
|
+
*
|
|
23
80
|
* @category Bash
|
|
24
81
|
* @since 4.0.0
|
|
25
82
|
*/
|
|
@@ -37,11 +94,18 @@ export const Bash_20241022 = /*#__PURE__*/Tool.providerDefined({
|
|
|
37
94
|
/**
|
|
38
95
|
* Anthropic Bash tool (2025-01-24 version).
|
|
39
96
|
*
|
|
97
|
+
* **When to use**
|
|
98
|
+
*
|
|
99
|
+
* Use when you need the model to execute bash commands and require the 2025-01-24
|
|
100
|
+
* version of the Anthropic computer-use beta.
|
|
101
|
+
*
|
|
40
102
|
* **Details**
|
|
41
103
|
*
|
|
42
104
|
* Allows the model to execute bash commands in a sandboxed environment.
|
|
43
105
|
* Requires the "computer-use-2025-01-24" beta header.
|
|
44
106
|
*
|
|
107
|
+
* @see {@link Bash_20241022} for the older 2024-10-22 version of the bash tool
|
|
108
|
+
*
|
|
45
109
|
* @category Bash
|
|
46
110
|
* @since 4.0.0
|
|
47
111
|
*/
|
|
@@ -65,6 +129,13 @@ export const Bash_20250124 = /*#__PURE__*/Tool.providerDefined({
|
|
|
65
129
|
/**
|
|
66
130
|
* Schema for a code execution request that asks Anthropic to run source code as a programmatic tool call.
|
|
67
131
|
*
|
|
132
|
+
* **When to use**
|
|
133
|
+
*
|
|
134
|
+
* Use when constructing or validating a programmatic tool call for the Anthropic
|
|
135
|
+
* Code Execution tool.
|
|
136
|
+
*
|
|
137
|
+
* @see {@link CodeExecution_20250522} for the parent tool definition
|
|
138
|
+
*
|
|
68
139
|
* @category Code Execution
|
|
69
140
|
* @since 4.0.0
|
|
70
141
|
*/
|
|
@@ -76,7 +147,19 @@ export const CodeExecutionProgrammaticToolCall = /*#__PURE__*/Schema.Struct({
|
|
|
76
147
|
code: Schema.String
|
|
77
148
|
});
|
|
78
149
|
/**
|
|
79
|
-
* Schema for
|
|
150
|
+
* Schema for the `bash_code_execution` input variant of Anthropic Code Execution.
|
|
151
|
+
*
|
|
152
|
+
* **When to use**
|
|
153
|
+
*
|
|
154
|
+
* Use when validating or constructing a bash command request for
|
|
155
|
+
* `CodeExecution_20250522`.
|
|
156
|
+
*
|
|
157
|
+
* **Details**
|
|
158
|
+
*
|
|
159
|
+
* The schema requires `type` to be `"bash_code_execution"` and `command` to
|
|
160
|
+
* contain the bash command sent to Anthropic.
|
|
161
|
+
*
|
|
162
|
+
* @see {@link CodeExecution_20250522} for the provider-defined tool that consumes this input variant
|
|
80
163
|
*
|
|
81
164
|
* @category Code Execution
|
|
82
165
|
* @since 4.0.0
|
|
@@ -89,7 +172,20 @@ export const CodeExecutionBashCommand = /*#__PURE__*/Schema.Struct({
|
|
|
89
172
|
command: Schema.String
|
|
90
173
|
});
|
|
91
174
|
/**
|
|
92
|
-
*
|
|
175
|
+
* Schema for a code execution text editor request that views a file by path.
|
|
176
|
+
*
|
|
177
|
+
* **When to use**
|
|
178
|
+
*
|
|
179
|
+
* Use to validate or construct the `view` command for Anthropic code execution
|
|
180
|
+
* text editor tool calls.
|
|
181
|
+
*
|
|
182
|
+
* **Details**
|
|
183
|
+
*
|
|
184
|
+
* The encoded payload uses `type: "text_editor_code_execution"`,
|
|
185
|
+
* `command: "view"`, and a `path` string.
|
|
186
|
+
*
|
|
187
|
+
* @see {@link CodeExecutionTextEditorCreate} for the command that creates a file
|
|
188
|
+
* @see {@link CodeExecutionTextEditorStrReplace} for the command that replaces text in a file
|
|
93
189
|
*
|
|
94
190
|
* @category Code Execution
|
|
95
191
|
* @since 4.0.0
|
|
@@ -103,7 +199,22 @@ export const CodeExecutionTextEditorView = /*#__PURE__*/Schema.Struct({
|
|
|
103
199
|
path: Schema.String
|
|
104
200
|
});
|
|
105
201
|
/**
|
|
106
|
-
*
|
|
202
|
+
* Schema for a text editor code execution request that creates a file at a path.
|
|
203
|
+
*
|
|
204
|
+
* **When to use**
|
|
205
|
+
*
|
|
206
|
+
* Use when validating or constructing an Anthropic `text_editor_code_execution`
|
|
207
|
+
* tool call that should create a file.
|
|
208
|
+
*
|
|
209
|
+
* **Details**
|
|
210
|
+
*
|
|
211
|
+
* The request is discriminated by `type: "text_editor_code_execution"` and
|
|
212
|
+
* `command: "create"`. It requires `path` and accepts optional `file_text`; the
|
|
213
|
+
* schema allows `file_text` to be omitted, `null`, or a string.
|
|
214
|
+
*
|
|
215
|
+
* @see {@link CodeExecution_20250522} for the provider-defined tool that consumes this request
|
|
216
|
+
* @see {@link CodeExecutionTextEditorView} for the matching view request
|
|
217
|
+
* @see {@link CodeExecutionTextEditorStrReplace} for the matching replace request
|
|
107
218
|
*
|
|
108
219
|
* @category Code Execution
|
|
109
220
|
* @since 4.0.0
|
|
@@ -121,7 +232,20 @@ export const CodeExecutionTextEditorCreate = /*#__PURE__*/Schema.Struct({
|
|
|
121
232
|
file_text: /*#__PURE__*/Schema.optional(/*#__PURE__*/Schema.NullOr(Schema.String))
|
|
122
233
|
});
|
|
123
234
|
/**
|
|
124
|
-
*
|
|
235
|
+
* Schema for a code execution text editor request that replaces one exact string in a file.
|
|
236
|
+
*
|
|
237
|
+
* **When to use**
|
|
238
|
+
*
|
|
239
|
+
* Use when validating or constructing the `str_replace` text editor operation
|
|
240
|
+
* for the 2025-05-22 Anthropic code execution tool.
|
|
241
|
+
*
|
|
242
|
+
* **Gotchas**
|
|
243
|
+
*
|
|
244
|
+
* The `old_str` must match the file contents exactly, including whitespace and
|
|
245
|
+
* indentation, and must identify a single occurrence.
|
|
246
|
+
*
|
|
247
|
+
* @see {@link CodeExecutionTextEditorView} for reading file contents before choosing the replacement text
|
|
248
|
+
* @see {@link CodeExecution_20250522} for the provider-defined tool that consumes this payload
|
|
125
249
|
*
|
|
126
250
|
* @category Code Execution
|
|
127
251
|
* @since 4.0.0
|
|
@@ -149,6 +273,13 @@ const CodeExecution_20250522_Parameters = /*#__PURE__*/Schema.Union([CodeExecuti
|
|
|
149
273
|
/**
|
|
150
274
|
* Schema for the 2025-08-25 code execution tool input, containing the code to execute.
|
|
151
275
|
*
|
|
276
|
+
* **When to use**
|
|
277
|
+
*
|
|
278
|
+
* Use when validating or constructing the input payload for the 2025-08-25
|
|
279
|
+
* Anthropic code execution tool.
|
|
280
|
+
*
|
|
281
|
+
* @see {@link CodeExecution_20250825} for the provider-defined tool that consumes this schema
|
|
282
|
+
*
|
|
152
283
|
* @category Code Execution
|
|
153
284
|
* @since 4.0.0
|
|
154
285
|
*/
|
|
@@ -164,12 +295,19 @@ export const CodeExecution_20250825_Parameters = /*#__PURE__*/Schema.Struct({
|
|
|
164
295
|
/**
|
|
165
296
|
* Anthropic Code Execution tool (2025-05-22 version).
|
|
166
297
|
*
|
|
298
|
+
* **When to use**
|
|
299
|
+
*
|
|
300
|
+
* Use when you need the model to execute code in a sandboxed environment and
|
|
301
|
+
* require the 2025-05-22 version of the Anthropic code-execution beta.
|
|
302
|
+
*
|
|
167
303
|
* **Details**
|
|
168
304
|
*
|
|
169
305
|
* Allows the model to execute code in a sandboxed environment with support
|
|
170
306
|
* for multiple execution types including programmatic tool calls, bash
|
|
171
307
|
* execution, and text editor operations.
|
|
172
308
|
*
|
|
309
|
+
* @see {@link CodeExecutionProgrammaticToolCall} for the programmatic tool call schema
|
|
310
|
+
*
|
|
173
311
|
* @category Code Execution
|
|
174
312
|
* @since 4.0.0
|
|
175
313
|
*/
|
|
@@ -184,9 +322,18 @@ export const CodeExecution_20250522 = /*#__PURE__*/Tool.providerDefined({
|
|
|
184
322
|
/**
|
|
185
323
|
* Anthropic Code Execution tool (2025-08-25 version).
|
|
186
324
|
*
|
|
325
|
+
* **When to use**
|
|
326
|
+
*
|
|
327
|
+
* Use when you need the model to execute code in a sandboxed environment and
|
|
328
|
+
* require the 2025-08-25 version of the Anthropic code-execution beta.
|
|
329
|
+
*
|
|
187
330
|
* **Details**
|
|
188
331
|
*
|
|
189
|
-
*
|
|
332
|
+
* Requires the `code-execution-2025-08-25` beta header and uses
|
|
333
|
+
* `CodeExecution_20250825_Parameters` as its input schema.
|
|
334
|
+
*
|
|
335
|
+
* @see {@link CodeExecution_20250522} for the older 2025-05-22 code execution tool
|
|
336
|
+
* @see {@link CodeExecution_20250825_Parameters} for the input schema consumed by this tool
|
|
190
337
|
*
|
|
191
338
|
* @category Code Execution
|
|
192
339
|
* @since 4.0.0
|
|
@@ -206,28 +353,52 @@ export const CodeExecution_20250825 = /*#__PURE__*/Tool.providerDefined({
|
|
|
206
353
|
// Common Types
|
|
207
354
|
// -----------------------------------------------------------------------------
|
|
208
355
|
/**
|
|
209
|
-
*
|
|
356
|
+
* Schema for an `[x, y]` screen coordinate in pixels.
|
|
357
|
+
*
|
|
358
|
+
* **Details**
|
|
359
|
+
*
|
|
360
|
+
* This is a two-number tuple used by computer-use actions that accept screen
|
|
361
|
+
* positions.
|
|
362
|
+
*
|
|
363
|
+
* **Gotchas**
|
|
364
|
+
*
|
|
365
|
+
* This schema validates tuple shape only and does not check display bounds.
|
|
210
366
|
*
|
|
211
367
|
* @category Computer Use
|
|
212
368
|
* @since 4.0.0
|
|
213
369
|
*/
|
|
214
370
|
export const Coordinate = /*#__PURE__*/Schema.Tuple([Schema.Number, Schema.Number]);
|
|
215
371
|
/**
|
|
216
|
-
*
|
|
372
|
+
* Schema for an `[x1, y1, x2, y2]` screen region in pixels.
|
|
373
|
+
*
|
|
374
|
+
* **Details**
|
|
375
|
+
*
|
|
376
|
+
* The tuple represents top-left and bottom-right corners.
|
|
377
|
+
*
|
|
378
|
+
* **Gotchas**
|
|
379
|
+
*
|
|
380
|
+
* This schema validates four numbers only and does not check coordinate ordering
|
|
381
|
+
* or display bounds.
|
|
217
382
|
*
|
|
218
383
|
* @category Computer Use
|
|
219
384
|
* @since 4.0.0
|
|
220
385
|
*/
|
|
221
386
|
export const Region = /*#__PURE__*/Schema.Tuple([Schema.Number, Schema.Number, Schema.Number, Schema.Number]);
|
|
222
387
|
/**
|
|
223
|
-
*
|
|
388
|
+
* Scroll direction literal: `"up"`, `"down"`, `"left"`, or `"right"`.
|
|
389
|
+
*
|
|
390
|
+
* @see {@link ComputerUseScrollAction} for the action payload that consumes this schema
|
|
224
391
|
*
|
|
225
392
|
* @category Computer Use
|
|
226
393
|
* @since 4.0.0
|
|
227
394
|
*/
|
|
228
395
|
export const ScrollDirection = /*#__PURE__*/Schema.Literals(["up", "down", "left", "right"]);
|
|
229
396
|
/**
|
|
230
|
-
* Modifier
|
|
397
|
+
* Modifier key literal.
|
|
398
|
+
*
|
|
399
|
+
* **Details**
|
|
400
|
+
*
|
|
401
|
+
* Allowed values are `"alt"`, `"ctrl"`, `"meta"`, and `"shift"`.
|
|
231
402
|
*
|
|
232
403
|
* @category Computer Use
|
|
233
404
|
* @since 4.0.0
|
|
@@ -260,7 +431,16 @@ const ComputerUse_20251124_Args = /*#__PURE__*/Schema.Struct({
|
|
|
260
431
|
// Computer Use 20241022 Actions
|
|
261
432
|
// -----------------------------------------------------------------------------
|
|
262
433
|
/**
|
|
263
|
-
*
|
|
434
|
+
* Schema for a computer-use action that presses a key or key combination, such
|
|
435
|
+
* as `"Return"`, `"ctrl+c"`, or `"ctrl+s"`.
|
|
436
|
+
*
|
|
437
|
+
* **When to use**
|
|
438
|
+
*
|
|
439
|
+
* Use when validating or constructing a computer-use action for keyboard
|
|
440
|
+
* shortcuts or non-text key presses.
|
|
441
|
+
*
|
|
442
|
+
* @see {@link TypeAction} for entering ordinary text strings
|
|
443
|
+
* @see {@link ComputerUseHoldKeyAction} for holding a key for a duration
|
|
264
444
|
*
|
|
265
445
|
* @category Computer Use
|
|
266
446
|
* @since 4.0.0
|
|
@@ -273,7 +453,27 @@ export const ComputerUseKeyAction = /*#__PURE__*/Schema.Struct({
|
|
|
273
453
|
text: Schema.String
|
|
274
454
|
});
|
|
275
455
|
/**
|
|
276
|
-
*
|
|
456
|
+
* Schema for a computer-use action that performs a left click.
|
|
457
|
+
*
|
|
458
|
+
* **When to use**
|
|
459
|
+
*
|
|
460
|
+
* Use to validate or construct an Anthropic computer-use payload for clicking
|
|
461
|
+
* once at the current mouse position or at a specific screen coordinate.
|
|
462
|
+
*
|
|
463
|
+
* **Details**
|
|
464
|
+
*
|
|
465
|
+
* The encoded payload uses `action: "left_click"`. The optional `coordinate`
|
|
466
|
+
* field supplies the `[x, y]` pixel position; when omitted, the action uses the
|
|
467
|
+
* current mouse position.
|
|
468
|
+
*
|
|
469
|
+
* **Gotchas**
|
|
470
|
+
*
|
|
471
|
+
* The coordinate schema only checks that the value is a two-number tuple. It
|
|
472
|
+
* does not validate that the point falls within the configured display
|
|
473
|
+
* dimensions.
|
|
474
|
+
*
|
|
475
|
+
* @see {@link ComputerUseDoubleClickAction} for performing a double click
|
|
476
|
+
* @see {@link ComputerUseMouseMoveAction} for moving the mouse without clicking
|
|
277
477
|
*
|
|
278
478
|
* @category Computer Use
|
|
279
479
|
* @since 4.0.0
|
|
@@ -287,7 +487,24 @@ export const ComputerUseLeftClickAction = /*#__PURE__*/Schema.Struct({
|
|
|
287
487
|
coordinate: /*#__PURE__*/Schema.optional(Coordinate)
|
|
288
488
|
});
|
|
289
489
|
/**
|
|
290
|
-
*
|
|
490
|
+
* Schema for a computer-use action that moves the mouse cursor to a required
|
|
491
|
+
* `[x, y]` screen coordinate.
|
|
492
|
+
*
|
|
493
|
+
* **When to use**
|
|
494
|
+
*
|
|
495
|
+
* Use to validate or construct a mouse movement action for an Anthropic
|
|
496
|
+
* computer-use tool call.
|
|
497
|
+
*
|
|
498
|
+
* **Details**
|
|
499
|
+
*
|
|
500
|
+
* The encoded payload has action `"mouse_move"` and a required `coordinate`
|
|
501
|
+
* field containing the target `[x, y]` pixel position.
|
|
502
|
+
*
|
|
503
|
+
* **Gotchas**
|
|
504
|
+
*
|
|
505
|
+
* The coordinate schema only checks that the value is a two-number tuple. It
|
|
506
|
+
* does not validate that the point falls within the configured display
|
|
507
|
+
* dimensions.
|
|
291
508
|
*
|
|
292
509
|
* @category Computer Use
|
|
293
510
|
* @since 4.0.0
|
|
@@ -300,7 +517,19 @@ export const ComputerUseMouseMoveAction = /*#__PURE__*/Schema.Struct({
|
|
|
300
517
|
coordinate: Coordinate
|
|
301
518
|
});
|
|
302
519
|
/**
|
|
303
|
-
*
|
|
520
|
+
* Schema for a computer-use action that requests a screenshot of the current display.
|
|
521
|
+
*
|
|
522
|
+
* **When to use**
|
|
523
|
+
*
|
|
524
|
+
* Use to validate or construct a computer-use tool action that asks the handler
|
|
525
|
+
* to capture the full current display.
|
|
526
|
+
*
|
|
527
|
+
* **Details**
|
|
528
|
+
*
|
|
529
|
+
* The payload contains only `action: "screenshot"` and does not include
|
|
530
|
+
* coordinates or other options.
|
|
531
|
+
*
|
|
532
|
+
* @see {@link ComputerUseZoomAction} for requesting a zoomed-in screenshot of a specific screen region with the 2025-11-24 computer-use tool
|
|
304
533
|
*
|
|
305
534
|
* @category Computer Use
|
|
306
535
|
* @since 4.0.0
|
|
@@ -309,7 +538,19 @@ export const ComputerUseScreenshotAction = /*#__PURE__*/Schema.Struct({
|
|
|
309
538
|
action: /*#__PURE__*/Schema.Literal("screenshot")
|
|
310
539
|
});
|
|
311
540
|
/**
|
|
312
|
-
*
|
|
541
|
+
* Schema for a computer-use action that enters text.
|
|
542
|
+
*
|
|
543
|
+
* **When to use**
|
|
544
|
+
*
|
|
545
|
+
* Use to validate or construct a computer-use action for entering ordinary text
|
|
546
|
+
* strings.
|
|
547
|
+
*
|
|
548
|
+
* **Details**
|
|
549
|
+
*
|
|
550
|
+
* The payload uses `action: "type"` and a `text` string containing the text to
|
|
551
|
+
* enter.
|
|
552
|
+
*
|
|
553
|
+
* @see {@link ComputerUseKeyAction} for key presses and keyboard shortcuts
|
|
313
554
|
*
|
|
314
555
|
* @category Computer Use
|
|
315
556
|
* @since 4.0.0
|
|
@@ -326,7 +567,26 @@ const ComputerUse_20241022_Actions = /*#__PURE__*/Schema.Union([ComputerUseKeyAc
|
|
|
326
567
|
// Computer Use 20250124 Actions
|
|
327
568
|
// -----------------------------------------------------------------------------
|
|
328
569
|
/**
|
|
329
|
-
*
|
|
570
|
+
* Schema for a computer-use action that performs a double click.
|
|
571
|
+
*
|
|
572
|
+
* **When to use**
|
|
573
|
+
*
|
|
574
|
+
* Use to validate or construct an Anthropic computer-use payload for double
|
|
575
|
+
* clicking at the current mouse position or at a specific screen coordinate.
|
|
576
|
+
*
|
|
577
|
+
* **Details**
|
|
578
|
+
*
|
|
579
|
+
* The encoded payload uses `action: "double_click"`. The optional
|
|
580
|
+
* `coordinate` field supplies the `[x, y]` pixel position; when omitted, the
|
|
581
|
+
* action uses the current mouse position.
|
|
582
|
+
*
|
|
583
|
+
* **Gotchas**
|
|
584
|
+
*
|
|
585
|
+
* The coordinate schema only checks that the value is a two-number tuple. It
|
|
586
|
+
* does not validate that the point falls within the configured display
|
|
587
|
+
* dimensions.
|
|
588
|
+
*
|
|
589
|
+
* @see {@link ComputerUseLeftClickAction} for performing a single left click
|
|
330
590
|
*
|
|
331
591
|
* @category Computer Use
|
|
332
592
|
* @since 4.0.0
|
|
@@ -342,6 +602,25 @@ export const ComputerUseDoubleClickAction = /*#__PURE__*/Schema.Struct({
|
|
|
342
602
|
/**
|
|
343
603
|
* Hold a key for a specified duration during computer-use execution.
|
|
344
604
|
*
|
|
605
|
+
* **When to use**
|
|
606
|
+
*
|
|
607
|
+
* Use to keep a keyboard key depressed for a fixed number of seconds in a
|
|
608
|
+
* computer-use action sequence.
|
|
609
|
+
*
|
|
610
|
+
* **Details**
|
|
611
|
+
*
|
|
612
|
+
* The schema describes objects with `action: "hold_key"`, a `text` field
|
|
613
|
+
* containing the key to hold, and a `duration` field containing the number of
|
|
614
|
+
* seconds to hold it.
|
|
615
|
+
*
|
|
616
|
+
* **Gotchas**
|
|
617
|
+
*
|
|
618
|
+
* The schema only checks that `duration` is a number; it does not require a
|
|
619
|
+
* positive value.
|
|
620
|
+
*
|
|
621
|
+
* @see {@link ComputerUseKeyAction} for pressing a key or key combination without holding it
|
|
622
|
+
* @see {@link ComputerUseWaitAction} for pausing between actions without holding a key
|
|
623
|
+
*
|
|
345
624
|
* @category Computer Use
|
|
346
625
|
* @since 4.0.0
|
|
347
626
|
*/
|
|
@@ -357,7 +636,26 @@ export const ComputerUseHoldKeyAction = /*#__PURE__*/Schema.Struct({
|
|
|
357
636
|
duration: Schema.Number
|
|
358
637
|
});
|
|
359
638
|
/**
|
|
360
|
-
*
|
|
639
|
+
* Schema for a computer-use action that drags with the left mouse button.
|
|
640
|
+
*
|
|
641
|
+
* **When to use**
|
|
642
|
+
*
|
|
643
|
+
* Use to validate or construct an Anthropic computer-use payload for dragging
|
|
644
|
+
* from one screen coordinate to another in a single action.
|
|
645
|
+
*
|
|
646
|
+
* **Details**
|
|
647
|
+
*
|
|
648
|
+
* The encoded payload uses `action: "left_click_drag"` and requires both
|
|
649
|
+
* `start_coordinate` and `coordinate` as `[x, y]` pixel positions.
|
|
650
|
+
*
|
|
651
|
+
* **Gotchas**
|
|
652
|
+
*
|
|
653
|
+
* The coordinate schema only checks that each value is a two-number tuple. It
|
|
654
|
+
* does not validate that either point falls within the configured display
|
|
655
|
+
* dimensions.
|
|
656
|
+
*
|
|
657
|
+
* @see {@link ComputerUseLeftMouseDownAction} for starting a manual drag sequence
|
|
658
|
+
* @see {@link ComputerUseLeftMouseUpAction} for ending a manual drag sequence
|
|
361
659
|
*
|
|
362
660
|
* @category Computer Use
|
|
363
661
|
* @since 4.0.0
|
|
@@ -378,7 +676,7 @@ export const ComputerUseLeftClickDragAction = /*#__PURE__*/Schema.Struct({
|
|
|
378
676
|
*
|
|
379
677
|
* **When to use**
|
|
380
678
|
*
|
|
381
|
-
* Use this for fine-grained click control.
|
|
679
|
+
* Use when you use this for fine-grained click control.
|
|
382
680
|
*
|
|
383
681
|
* @category Computer Use
|
|
384
682
|
* @since 4.0.0
|
|
@@ -396,7 +694,7 @@ export const ComputerUseLeftMouseDownAction = /*#__PURE__*/Schema.Struct({
|
|
|
396
694
|
*
|
|
397
695
|
* **When to use**
|
|
398
696
|
*
|
|
399
|
-
* Use this for fine-grained click control.
|
|
697
|
+
* Use when you use this for fine-grained click control.
|
|
400
698
|
*
|
|
401
699
|
* @category Computer Use
|
|
402
700
|
* @since 4.0.0
|
|
@@ -410,7 +708,26 @@ export const ComputerUseLeftMouseUpAction = /*#__PURE__*/Schema.Struct({
|
|
|
410
708
|
coordinate: /*#__PURE__*/Schema.optional(Coordinate)
|
|
411
709
|
});
|
|
412
710
|
/**
|
|
413
|
-
*
|
|
711
|
+
* Schema for a computer-use action that performs a middle click.
|
|
712
|
+
*
|
|
713
|
+
* **When to use**
|
|
714
|
+
*
|
|
715
|
+
* Use to validate or construct a middle-button click action for Anthropic
|
|
716
|
+
* computer use, optionally targeting a specific screen coordinate.
|
|
717
|
+
*
|
|
718
|
+
* **Details**
|
|
719
|
+
*
|
|
720
|
+
* The payload must use `action: "middle_click"`. When `coordinate` is omitted,
|
|
721
|
+
* the click occurs at the current mouse position.
|
|
722
|
+
*
|
|
723
|
+
* **Gotchas**
|
|
724
|
+
*
|
|
725
|
+
* This action is available in the 2025-01-24 computer-use action set and later;
|
|
726
|
+
* it is not part of `ComputerUse_20241022`.
|
|
727
|
+
*
|
|
728
|
+
* @see {@link ComputerUse_20250124} for the provider-defined tool version that first accepts this action
|
|
729
|
+
* @see {@link ComputerUseLeftClickAction} for primary-button clicks
|
|
730
|
+
* @see {@link ComputerUseRightClickAction} for secondary-button clicks
|
|
414
731
|
*
|
|
415
732
|
* @category Computer Use
|
|
416
733
|
* @since 4.0.0
|
|
@@ -424,7 +741,22 @@ export const ComputerUseMiddleClickAction = /*#__PURE__*/Schema.Struct({
|
|
|
424
741
|
coordinate: /*#__PURE__*/Schema.optional(Coordinate)
|
|
425
742
|
});
|
|
426
743
|
/**
|
|
427
|
-
*
|
|
744
|
+
* Schema for a computer-use action that performs a right click, optionally at a
|
|
745
|
+
* specific screen coordinate.
|
|
746
|
+
*
|
|
747
|
+
* **When to use**
|
|
748
|
+
*
|
|
749
|
+
* Use to validate or construct the `right_click` action for an Anthropic
|
|
750
|
+
* computer-use tool call.
|
|
751
|
+
*
|
|
752
|
+
* **Details**
|
|
753
|
+
*
|
|
754
|
+
* The optional `coordinate` field is an `[x, y]` screen coordinate in pixels.
|
|
755
|
+
* When omitted, the right click is performed at the current mouse position.
|
|
756
|
+
*
|
|
757
|
+
* @see {@link ComputerUse_20250124} for the provider-defined computer-use tool version that introduced this action
|
|
758
|
+
* @see {@link ComputerUseLeftClickAction} for the corresponding left-click action
|
|
759
|
+
* @see {@link ComputerUseMiddleClickAction} for the corresponding middle-click action
|
|
428
760
|
*
|
|
429
761
|
* @category Computer Use
|
|
430
762
|
* @since 4.0.0
|
|
@@ -438,7 +770,24 @@ export const ComputerUseRightClickAction = /*#__PURE__*/Schema.Struct({
|
|
|
438
770
|
coordinate: /*#__PURE__*/Schema.optional(Coordinate)
|
|
439
771
|
});
|
|
440
772
|
/**
|
|
441
|
-
*
|
|
773
|
+
* Schema for a computer-use scroll action.
|
|
774
|
+
*
|
|
775
|
+
* **When to use**
|
|
776
|
+
*
|
|
777
|
+
* Use when validating or constructing Anthropic computer-use scroll payloads.
|
|
778
|
+
*
|
|
779
|
+
* **Details**
|
|
780
|
+
*
|
|
781
|
+
* The encoded payload uses `action: "scroll"`, an optional `coordinate`,
|
|
782
|
+
* `scroll_direction`, and `scroll_amount`.
|
|
783
|
+
*
|
|
784
|
+
* **Gotchas**
|
|
785
|
+
*
|
|
786
|
+
* `coordinate` only checks a two-number tuple, and `scroll_amount` is only
|
|
787
|
+
* `Schema.Number`.
|
|
788
|
+
*
|
|
789
|
+
* @see {@link ComputerUse_20250124} for the tool version that accepts this action
|
|
790
|
+
* @see {@link ScrollDirection} for the accepted direction literals
|
|
442
791
|
*
|
|
443
792
|
* @category Computer Use
|
|
444
793
|
* @since 4.0.0
|
|
@@ -460,7 +809,26 @@ export const ComputerUseScrollAction = /*#__PURE__*/Schema.Struct({
|
|
|
460
809
|
scroll_amount: Schema.Number
|
|
461
810
|
});
|
|
462
811
|
/**
|
|
463
|
-
*
|
|
812
|
+
* Schema for a computer-use triple-click action.
|
|
813
|
+
*
|
|
814
|
+
* **When to use**
|
|
815
|
+
*
|
|
816
|
+
* Use when validating or constructing Anthropic computer-use triple-click
|
|
817
|
+
* payloads at the current pointer position or an optional coordinate.
|
|
818
|
+
*
|
|
819
|
+
* **Details**
|
|
820
|
+
*
|
|
821
|
+
* The encoded payload uses `action: "triple_click"` and an optional
|
|
822
|
+
* `coordinate`.
|
|
823
|
+
*
|
|
824
|
+
* **Gotchas**
|
|
825
|
+
*
|
|
826
|
+
* `coordinate` only validates as a two-number tuple and does not check display
|
|
827
|
+
* bounds.
|
|
828
|
+
*
|
|
829
|
+
* @see {@link ComputerUse_20250124} for the tool version that accepts this action
|
|
830
|
+
* @see {@link ComputerUseDoubleClickAction} for the two-click variant
|
|
831
|
+
* @see {@link ComputerUseLeftClickAction} for a single left click
|
|
464
832
|
*
|
|
465
833
|
* @category Computer Use
|
|
466
834
|
* @since 4.0.0
|
|
@@ -474,7 +842,25 @@ export const ComputerUseTripleClickAction = /*#__PURE__*/Schema.Struct({
|
|
|
474
842
|
coordinate: /*#__PURE__*/Schema.optional(Coordinate)
|
|
475
843
|
});
|
|
476
844
|
/**
|
|
477
|
-
*
|
|
845
|
+
* Schema for a computer-use wait action.
|
|
846
|
+
*
|
|
847
|
+
* **When to use**
|
|
848
|
+
*
|
|
849
|
+
* Use when validating or constructing Anthropic computer-use payloads that pause
|
|
850
|
+
* between actions.
|
|
851
|
+
*
|
|
852
|
+
* **Details**
|
|
853
|
+
*
|
|
854
|
+
* The encoded payload uses `action: "wait"` and a required `duration` in
|
|
855
|
+
* seconds.
|
|
856
|
+
*
|
|
857
|
+
* **Gotchas**
|
|
858
|
+
*
|
|
859
|
+
* `duration` is only `Schema.Number`; it is not constrained to positive or
|
|
860
|
+
* finite values.
|
|
861
|
+
*
|
|
862
|
+
* @see {@link ComputerUseHoldKeyAction} for another duration-based computer-use action
|
|
863
|
+
* @see {@link ComputerUse_20250124} for the tool version that accepts this action
|
|
478
864
|
*
|
|
479
865
|
* @category Computer Use
|
|
480
866
|
* @since 4.0.0
|
|
@@ -495,7 +881,15 @@ const ComputerUse_20250124_Actions = /*#__PURE__*/Schema.Union([...ComputerUse_2
|
|
|
495
881
|
*
|
|
496
882
|
* **Details**
|
|
497
883
|
*
|
|
498
|
-
*
|
|
884
|
+
* The encoded payload uses `action: "zoom"` and a `region` tuple.
|
|
885
|
+
*
|
|
886
|
+
* **Gotchas**
|
|
887
|
+
*
|
|
888
|
+
* Requires `enableZoom: true` in the tool definition. `region` is only a
|
|
889
|
+
* four-number tuple and does not validate corner ordering or display bounds.
|
|
890
|
+
*
|
|
891
|
+
* @see {@link ComputerUse_20251124} for the tool version that accepts this action
|
|
892
|
+
* @see {@link ComputerUseScreenshotAction} for capturing the full screen instead
|
|
499
893
|
*
|
|
500
894
|
* @category Computer Use
|
|
501
895
|
* @since 4.0.0
|
|
@@ -535,6 +929,11 @@ export const ComputerUse_20241022 = /*#__PURE__*/Tool.providerDefined({
|
|
|
535
929
|
/**
|
|
536
930
|
* Computer use tool for Claude 4 models and Claude Sonnet 3.7.
|
|
537
931
|
*
|
|
932
|
+
* **When to use**
|
|
933
|
+
*
|
|
934
|
+
* Use when configuring Anthropic computer use for Claude 4 models or Claude
|
|
935
|
+
* Sonnet 3.7 with the 2025-01-24 action set.
|
|
936
|
+
*
|
|
538
937
|
* **Details**
|
|
539
938
|
*
|
|
540
939
|
* Requires the "computer-use-2025-01-24" beta header.
|
|
@@ -542,6 +941,9 @@ export const ComputerUse_20241022 = /*#__PURE__*/Tool.providerDefined({
|
|
|
542
941
|
* right_click, middle_click, double_click, triple_click, left_mouse_down,
|
|
543
942
|
* left_mouse_up, hold_key, wait.
|
|
544
943
|
*
|
|
944
|
+
* @see {@link ComputerUse_20241022} for the older basic action set
|
|
945
|
+
* @see {@link ComputerUse_20251124} for the newer zoom-capable version
|
|
946
|
+
*
|
|
545
947
|
* @category Computer Use
|
|
546
948
|
* @since 4.0.0
|
|
547
949
|
*/
|
|
@@ -557,11 +959,23 @@ export const ComputerUse_20250124 = /*#__PURE__*/Tool.providerDefined({
|
|
|
557
959
|
/**
|
|
558
960
|
* Computer use tool for Claude Opus 4.5 only.
|
|
559
961
|
*
|
|
962
|
+
* **When to use**
|
|
963
|
+
*
|
|
964
|
+
* Use when configuring Anthropic computer use for Claude Opus 4.5 with the
|
|
965
|
+
* 2025-11-24 action set and zoom-capable screen inspection.
|
|
966
|
+
*
|
|
560
967
|
* **Details**
|
|
561
968
|
*
|
|
562
969
|
* Requires the "computer-use-2025-11-24" beta header.
|
|
563
970
|
* Includes all actions from computer_20250124 plus the zoom action for
|
|
564
|
-
* detailed screen region inspection.
|
|
971
|
+
* detailed screen region inspection.
|
|
972
|
+
*
|
|
973
|
+
* **Gotchas**
|
|
974
|
+
*
|
|
975
|
+
* Zoom actions require `enableZoom: true` in args.
|
|
976
|
+
*
|
|
977
|
+
* @see {@link ComputerUse_20250124} for the previous action set without zoom
|
|
978
|
+
* @see {@link ComputerUseZoomAction} for the zoom action payload
|
|
565
979
|
*
|
|
566
980
|
* @category Computer Use
|
|
567
981
|
* @since 4.0.0
|
|
@@ -584,12 +998,20 @@ export const ComputerUse_20251124 = /*#__PURE__*/Tool.providerDefined({
|
|
|
584
998
|
/**
|
|
585
999
|
* A `[start, end]` line range for viewing file contents.
|
|
586
1000
|
*
|
|
1001
|
+
* **When to use**
|
|
1002
|
+
*
|
|
1003
|
+
* Use when constructing or validating `view_range` for memory or text editor
|
|
1004
|
+
* view commands.
|
|
1005
|
+
*
|
|
587
1006
|
* **Details**
|
|
588
1007
|
*
|
|
589
|
-
* Lines are 1-indexed. Use
|
|
1008
|
+
* Lines are 1-indexed. Use `-1` for end to read to the end of the file. For
|
|
590
1009
|
* example, `[1, 50]` views lines 1-50 and `[100, -1]` views from line 100 to
|
|
591
1010
|
* the end of the file.
|
|
592
1011
|
*
|
|
1012
|
+
* @see {@link MemoryViewCommand} for memory view payloads that use this range
|
|
1013
|
+
* @see {@link TextEditorViewCommand} for text editor view payloads that use this range
|
|
1014
|
+
*
|
|
593
1015
|
* @category Memory
|
|
594
1016
|
* @since 4.0.0
|
|
595
1017
|
*/
|
|
@@ -598,7 +1020,11 @@ export const ViewRange = /*#__PURE__*/Schema.Tuple([Schema.Number, Schema.Number
|
|
|
598
1020
|
// Memory 20250818 Commands
|
|
599
1021
|
// -----------------------------------------------------------------------------
|
|
600
1022
|
/**
|
|
601
|
-
*
|
|
1023
|
+
* Schema for the memory tool command that creates a new file at a path.
|
|
1024
|
+
*
|
|
1025
|
+
* **Details**
|
|
1026
|
+
*
|
|
1027
|
+
* The payload contains `command: "create"` and a `path` string.
|
|
602
1028
|
*
|
|
603
1029
|
* @category Memory
|
|
604
1030
|
* @since 4.0.0
|
|
@@ -611,7 +1037,7 @@ export const MemoryCreateCommand = /*#__PURE__*/Schema.Struct({
|
|
|
611
1037
|
path: Schema.String
|
|
612
1038
|
});
|
|
613
1039
|
/**
|
|
614
|
-
*
|
|
1040
|
+
* Schema for a memory command that deletes a file or directory.
|
|
615
1041
|
*
|
|
616
1042
|
* @category Memory
|
|
617
1043
|
* @since 4.0.0
|
|
@@ -619,12 +1045,24 @@ export const MemoryCreateCommand = /*#__PURE__*/Schema.Struct({
|
|
|
619
1045
|
export const MemoryDeleteCommand = /*#__PURE__*/Schema.Struct({
|
|
620
1046
|
command: /*#__PURE__*/Schema.Literal("delete"),
|
|
621
1047
|
/**
|
|
622
|
-
* The path to the file to delete.
|
|
1048
|
+
* The path to the file or directory to delete.
|
|
623
1049
|
*/
|
|
624
1050
|
path: Schema.String
|
|
625
1051
|
});
|
|
626
1052
|
/**
|
|
627
|
-
*
|
|
1053
|
+
* Schema for the memory `insert` command.
|
|
1054
|
+
*
|
|
1055
|
+
* **When to use**
|
|
1056
|
+
*
|
|
1057
|
+
* Use when validating or constructing `insert` payloads for `Memory_20250818`.
|
|
1058
|
+
*
|
|
1059
|
+
* **Details**
|
|
1060
|
+
*
|
|
1061
|
+
* The payload is discriminated by `command: "insert"` and requires `path`,
|
|
1062
|
+
* `insert_line`, and `insert_text`.
|
|
1063
|
+
*
|
|
1064
|
+
* @see {@link Memory_20250818} for the provider-defined tool that consumes this command
|
|
1065
|
+
* @see {@link MemoryStrReplaceCommand} for replacing existing text instead
|
|
628
1066
|
*
|
|
629
1067
|
* @category Memory
|
|
630
1068
|
* @since 4.0.0
|
|
@@ -645,7 +1083,12 @@ export const MemoryInsertCommand = /*#__PURE__*/Schema.Struct({
|
|
|
645
1083
|
insert_text: Schema.String
|
|
646
1084
|
});
|
|
647
1085
|
/**
|
|
648
|
-
*
|
|
1086
|
+
* Schema for the memory command that renames or moves a file or directory.
|
|
1087
|
+
*
|
|
1088
|
+
* **Details**
|
|
1089
|
+
*
|
|
1090
|
+
* The payload uses `command: "rename"` and requires `old_path` as the current
|
|
1091
|
+
* path plus `new_path` as the new destination path.
|
|
649
1092
|
*
|
|
650
1093
|
* @category Memory
|
|
651
1094
|
* @since 4.0.0
|
|
@@ -662,7 +1105,19 @@ export const MemoryRenameCommand = /*#__PURE__*/Schema.Struct({
|
|
|
662
1105
|
new_path: Schema.String
|
|
663
1106
|
});
|
|
664
1107
|
/**
|
|
665
|
-
*
|
|
1108
|
+
* Schema for the memory `str_replace` command.
|
|
1109
|
+
*
|
|
1110
|
+
* **When to use**
|
|
1111
|
+
*
|
|
1112
|
+
* Use when validating or constructing `str_replace` payloads for
|
|
1113
|
+
* `Memory_20250818`.
|
|
1114
|
+
*
|
|
1115
|
+
* **Details**
|
|
1116
|
+
*
|
|
1117
|
+
* The payload is discriminated by `command: "str_replace"` and requires `path`,
|
|
1118
|
+
* `old_str`, and `new_str`.
|
|
1119
|
+
*
|
|
1120
|
+
* @see {@link Memory_20250818} for the provider-defined tool that consumes this command
|
|
666
1121
|
*
|
|
667
1122
|
* @category Memory
|
|
668
1123
|
* @since 4.0.0
|
|
@@ -685,13 +1140,18 @@ export const MemoryStrReplaceCommand = /*#__PURE__*/Schema.Struct({
|
|
|
685
1140
|
/**
|
|
686
1141
|
* Shows directory contents or file contents with optional line ranges.
|
|
687
1142
|
*
|
|
1143
|
+
* **Details**
|
|
1144
|
+
*
|
|
1145
|
+
* When used on a file, returns file contents optionally limited by `view_range`.
|
|
1146
|
+
* When used on a directory, lists contents.
|
|
1147
|
+
*
|
|
688
1148
|
* @category Memory
|
|
689
1149
|
* @since 4.0.0
|
|
690
1150
|
*/
|
|
691
1151
|
export const MemoryViewCommand = /*#__PURE__*/Schema.Struct({
|
|
692
1152
|
command: /*#__PURE__*/Schema.Literal("view"),
|
|
693
1153
|
/**
|
|
694
|
-
* The path to the file to view.
|
|
1154
|
+
* The path to the file or directory to view.
|
|
695
1155
|
*/
|
|
696
1156
|
path: Schema.String,
|
|
697
1157
|
/**
|
|
@@ -730,10 +1190,19 @@ export const Memory_20250818 = /*#__PURE__*/Tool.providerDefined({
|
|
|
730
1190
|
/**
|
|
731
1191
|
* View the contents of a file or list directory contents.
|
|
732
1192
|
*
|
|
1193
|
+
* **When to use**
|
|
1194
|
+
*
|
|
1195
|
+
* Use when validating or constructing the standalone Anthropic Text Editor
|
|
1196
|
+
* `view` command.
|
|
1197
|
+
*
|
|
733
1198
|
* **Details**
|
|
734
1199
|
*
|
|
735
1200
|
* When used on a file, returns the file contents, optionally limited to a line
|
|
736
1201
|
* range. When used on a directory, lists all files and subdirectories.
|
|
1202
|
+
* `view_range` is a 1-indexed `[start, end]` tuple where `-1` means through
|
|
1203
|
+
* the end of the file.
|
|
1204
|
+
*
|
|
1205
|
+
* @see {@link CodeExecutionTextEditorView} for the code-execution variant without `view_range`
|
|
737
1206
|
*
|
|
738
1207
|
* @category Text Editor
|
|
739
1208
|
* @since 4.0.0
|
|
@@ -753,6 +1222,16 @@ export const TextEditorViewCommand = /*#__PURE__*/Schema.Struct({
|
|
|
753
1222
|
/**
|
|
754
1223
|
* Create a new file with specified content.
|
|
755
1224
|
*
|
|
1225
|
+
* **When to use**
|
|
1226
|
+
*
|
|
1227
|
+
* Use when validating or constructing an Anthropic text editor `create`
|
|
1228
|
+
* command.
|
|
1229
|
+
*
|
|
1230
|
+
* **Details**
|
|
1231
|
+
*
|
|
1232
|
+
* The payload is discriminated by `command: "create"` and requires both `path`
|
|
1233
|
+
* and `file_text`.
|
|
1234
|
+
*
|
|
756
1235
|
* **Gotchas**
|
|
757
1236
|
*
|
|
758
1237
|
* Fails if the file already exists. Parent directories must exist.
|
|
@@ -774,11 +1253,24 @@ export const TextEditorCreateCommand = /*#__PURE__*/Schema.Struct({
|
|
|
774
1253
|
/**
|
|
775
1254
|
* Replace a specific string in a file with a new string.
|
|
776
1255
|
*
|
|
1256
|
+
* **When to use**
|
|
1257
|
+
*
|
|
1258
|
+
* Use when validating or constructing standalone Anthropic text editor
|
|
1259
|
+
* `str_replace` commands.
|
|
1260
|
+
*
|
|
1261
|
+
* **Details**
|
|
1262
|
+
*
|
|
1263
|
+
* The payload uses `command: "str_replace"`, `path`, `old_str`, and `new_str`.
|
|
1264
|
+
* `new_str` may be empty to delete text.
|
|
1265
|
+
*
|
|
777
1266
|
* **Gotchas**
|
|
778
1267
|
*
|
|
779
1268
|
* The `old_str` must match exactly (including whitespace and indentation)
|
|
780
1269
|
* and must be unique in the file.
|
|
781
1270
|
*
|
|
1271
|
+
* @see {@link TextEditorViewCommand} for reading contents before choosing `old_str`
|
|
1272
|
+
* @see {@link CodeExecutionTextEditorStrReplace} for the code-execution variant
|
|
1273
|
+
*
|
|
782
1274
|
* @category Text Editor
|
|
783
1275
|
* @since 4.0.0
|
|
784
1276
|
*/
|
|
@@ -802,7 +1294,8 @@ export const TextEditorStrReplaceCommand = /*#__PURE__*/Schema.Struct({
|
|
|
802
1294
|
*
|
|
803
1295
|
* **Details**
|
|
804
1296
|
*
|
|
805
|
-
* Inserts the new text
|
|
1297
|
+
* Inserts the new text after the specified line number. Use `0` to insert at
|
|
1298
|
+
* the beginning of the file; other values are 1-indexed.
|
|
806
1299
|
*
|
|
807
1300
|
* @category Text Editor
|
|
808
1301
|
* @since 4.0.0
|
|
@@ -827,12 +1320,14 @@ export const TextEditorInsertCommand = /*#__PURE__*/Schema.Struct({
|
|
|
827
1320
|
*
|
|
828
1321
|
* **Details**
|
|
829
1322
|
*
|
|
830
|
-
* Reverts the most recent str_replace
|
|
1323
|
+
* Reverts the most recent `str_replace`, `insert`, or `create` operation on the
|
|
1324
|
+
* file.
|
|
831
1325
|
*
|
|
832
1326
|
* **Gotchas**
|
|
833
1327
|
*
|
|
834
|
-
* This command is available in text_editor_20241022 and
|
|
835
|
-
* but not in
|
|
1328
|
+
* This command is available in `text_editor_20241022` and
|
|
1329
|
+
* `text_editor_20250124`, but not in `text_editor_20250429` or
|
|
1330
|
+
* `text_editor_20250728`.
|
|
836
1331
|
*
|
|
837
1332
|
* @category Text Editor
|
|
838
1333
|
* @since 4.0.0
|
|
@@ -862,9 +1357,18 @@ const TextEditor_StrReplaceBasedEdit_Args = /*#__PURE__*/Schema.Struct({
|
|
|
862
1357
|
/**
|
|
863
1358
|
* Text editor tool for Claude 3.5 Sonnet (deprecated).
|
|
864
1359
|
*
|
|
1360
|
+
* **When to use**
|
|
1361
|
+
*
|
|
1362
|
+
* Use when configuring the 2024-10-22 `str_replace_editor` compatibility path
|
|
1363
|
+
* for Claude 3.5 Sonnet.
|
|
1364
|
+
*
|
|
865
1365
|
* **Details**
|
|
866
1366
|
*
|
|
867
|
-
* Requires the "computer-use-2024-10-22" beta header
|
|
1367
|
+
* Requires the "computer-use-2024-10-22" beta header and supports `view`,
|
|
1368
|
+
* `create`, `str_replace`, `insert`, and `undo_edit` commands.
|
|
1369
|
+
*
|
|
1370
|
+
* @see {@link TextEditor_20250124} for the newer `str_replace_editor` version
|
|
1371
|
+
* @see {@link TextEditor_20250728} for the Claude 4 `str_replace_based_edit_tool` line
|
|
868
1372
|
*
|
|
869
1373
|
* @category Text Editor
|
|
870
1374
|
* @since 4.0.0
|
|
@@ -880,9 +1384,18 @@ export const TextEditor_20241022 = /*#__PURE__*/Tool.providerDefined({
|
|
|
880
1384
|
/**
|
|
881
1385
|
* Text editor tool for Claude Sonnet 3.7 (deprecated model).
|
|
882
1386
|
*
|
|
1387
|
+
* **When to use**
|
|
1388
|
+
*
|
|
1389
|
+
* Use when configuring the 2025-01-24 Claude Sonnet 3.7 text editor tool using
|
|
1390
|
+
* `str_replace_editor`.
|
|
1391
|
+
*
|
|
883
1392
|
* **Details**
|
|
884
1393
|
*
|
|
885
|
-
* Requires the "computer-use-2025-01-24" beta header
|
|
1394
|
+
* Requires the "computer-use-2025-01-24" beta header, requires a handler, and
|
|
1395
|
+
* supports `view`, `create`, `str_replace`, `insert`, and `undo_edit` commands.
|
|
1396
|
+
*
|
|
1397
|
+
* @see {@link TextEditor_20241022} for the older `str_replace_editor` version
|
|
1398
|
+
* @see {@link TextEditor_20250429} for the Claude 4 `str_replace_based_edit_tool` line
|
|
886
1399
|
*
|
|
887
1400
|
* @category Text Editor
|
|
888
1401
|
* @since 4.0.0
|
|
@@ -898,6 +1411,11 @@ export const TextEditor_20250124 = /*#__PURE__*/Tool.providerDefined({
|
|
|
898
1411
|
/**
|
|
899
1412
|
* Text editor tool for Claude 4 models using Anthropic's `str_replace_based_edit_tool`.
|
|
900
1413
|
*
|
|
1414
|
+
* **When to use**
|
|
1415
|
+
*
|
|
1416
|
+
* Use when configuring the 2025-04-29 Claude 4 `str_replace_based_edit_tool`
|
|
1417
|
+
* version.
|
|
1418
|
+
*
|
|
901
1419
|
* **Details**
|
|
902
1420
|
*
|
|
903
1421
|
* Requires the "computer-use-2025-01-24" beta header.
|
|
@@ -906,6 +1424,9 @@ export const TextEditor_20250124 = /*#__PURE__*/Tool.providerDefined({
|
|
|
906
1424
|
*
|
|
907
1425
|
* This version does not support the `undo_edit` command.
|
|
908
1426
|
*
|
|
1427
|
+
* @see {@link TextEditor_20250124} for the previous `str_replace_editor` version
|
|
1428
|
+
* @see {@link TextEditor_20250728} for the later Claude 4 text editor version
|
|
1429
|
+
*
|
|
909
1430
|
* @category Text Editor
|
|
910
1431
|
* @since 4.0.0
|
|
911
1432
|
*/
|
|
@@ -921,6 +1442,11 @@ export const TextEditor_20250429 = /*#__PURE__*/Tool.providerDefined({
|
|
|
921
1442
|
/**
|
|
922
1443
|
* Text editor tool for Claude 4 models.
|
|
923
1444
|
*
|
|
1445
|
+
* **Details**
|
|
1446
|
+
*
|
|
1447
|
+
* Uses Anthropic's `str_replace_based_edit_tool`. `max_characters` can limit
|
|
1448
|
+
* file-view output for this version.
|
|
1449
|
+
*
|
|
924
1450
|
* **Gotchas**
|
|
925
1451
|
*
|
|
926
1452
|
* This version does not support the `undo_edit` command.
|
|
@@ -948,8 +1474,16 @@ export const TextEditor_20250728 = /*#__PURE__*/Tool.providerDefined({
|
|
|
948
1474
|
*
|
|
949
1475
|
* **When to use**
|
|
950
1476
|
*
|
|
951
|
-
*
|
|
952
|
-
* queries like weather, local businesses, events
|
|
1477
|
+
* Use when providing location helps return more relevant results for
|
|
1478
|
+
* location-dependent queries like weather, local businesses, or events.
|
|
1479
|
+
*
|
|
1480
|
+
* **Details**
|
|
1481
|
+
*
|
|
1482
|
+
* The schema uses `type: "approximate"` plus optional `city`, `region`,
|
|
1483
|
+
* `country`, and `timezone`. `country` is an ISO 3166-1 alpha-2 code, and
|
|
1484
|
+
* `timezone` is an IANA time zone identifier.
|
|
1485
|
+
*
|
|
1486
|
+
* @see {@link WebSearch_20250305_Args} for the argument schema that consumes this location
|
|
953
1487
|
*
|
|
954
1488
|
* @category Web Search
|
|
955
1489
|
* @since 4.0.0
|
|
@@ -982,6 +1516,23 @@ export const WebSearchUserLocation = /*#__PURE__*/Schema.Struct({
|
|
|
982
1516
|
/**
|
|
983
1517
|
* Configuration arguments for the web search tool.
|
|
984
1518
|
*
|
|
1519
|
+
* **When to use**
|
|
1520
|
+
*
|
|
1521
|
+
* Use when configuring `WebSearch_20250305` with search limits, domain filters,
|
|
1522
|
+
* or user location.
|
|
1523
|
+
*
|
|
1524
|
+
* **Details**
|
|
1525
|
+
*
|
|
1526
|
+
* The payload can set `maxUses`, `allowedDomains`, `blockedDomains`, and
|
|
1527
|
+
* `userLocation`.
|
|
1528
|
+
*
|
|
1529
|
+
* **Gotchas**
|
|
1530
|
+
*
|
|
1531
|
+
* `allowedDomains` and `blockedDomains` are mutually exclusive.
|
|
1532
|
+
*
|
|
1533
|
+
* @see {@link WebSearch_20250305} for the provider-defined tool that consumes these arguments
|
|
1534
|
+
* @see {@link WebSearchUserLocation} for localizing search results
|
|
1535
|
+
*
|
|
985
1536
|
* @category Web Search
|
|
986
1537
|
* @since 4.0.0
|
|
987
1538
|
*/
|
|
@@ -1011,7 +1562,14 @@ export const WebSearch_20250305_Args = /*#__PURE__*/Schema.Struct({
|
|
|
1011
1562
|
// Web Search Parameters
|
|
1012
1563
|
// -----------------------------------------------------------------------------
|
|
1013
1564
|
/**
|
|
1014
|
-
*
|
|
1565
|
+
* Schema for Claude-supplied web search tool parameters.
|
|
1566
|
+
*
|
|
1567
|
+
* **Details**
|
|
1568
|
+
*
|
|
1569
|
+
* The payload contains the generated `query` string and is consumed by
|
|
1570
|
+
* `WebSearch_20250305`.
|
|
1571
|
+
*
|
|
1572
|
+
* @see {@link WebSearch_20250305} for the provider-defined tool that consumes this payload
|
|
1015
1573
|
*
|
|
1016
1574
|
* @category Web Search
|
|
1017
1575
|
* @since 4.0.0
|
|
@@ -1028,12 +1586,18 @@ export const WebSearchParameters = /*#__PURE__*/Schema.Struct({
|
|
|
1028
1586
|
/**
|
|
1029
1587
|
* Web search tool for Claude models.
|
|
1030
1588
|
*
|
|
1589
|
+
* **When to use**
|
|
1590
|
+
*
|
|
1591
|
+
* Use when Claude should search the web for real-time information.
|
|
1592
|
+
*
|
|
1031
1593
|
* **Details**
|
|
1032
1594
|
*
|
|
1033
1595
|
* Enables Claude to search the web for real-time information. This is a
|
|
1034
1596
|
* server-side tool executed by Anthropic's infrastructure.
|
|
1035
1597
|
* Generally available (no beta header required).
|
|
1036
1598
|
*
|
|
1599
|
+
* @see {@link WebFetch_20250910} for retrieving known URLs after discovery
|
|
1600
|
+
*
|
|
1037
1601
|
* @category Web Search
|
|
1038
1602
|
* @since 4.0.0
|
|
1039
1603
|
*/
|
|
@@ -1055,6 +1619,17 @@ export const WebSearch_20250305 = /*#__PURE__*/Tool.providerDefined({
|
|
|
1055
1619
|
/**
|
|
1056
1620
|
* Citation configuration for web fetch.
|
|
1057
1621
|
*
|
|
1622
|
+
* **When to use**
|
|
1623
|
+
*
|
|
1624
|
+
* Use when configuring whether web fetch results should include citations.
|
|
1625
|
+
*
|
|
1626
|
+
* **Details**
|
|
1627
|
+
*
|
|
1628
|
+
* The payload contains the `enabled` flag. `citations` is optional on
|
|
1629
|
+
* `WebFetch_20250910_Args`, and citations are disabled by default.
|
|
1630
|
+
*
|
|
1631
|
+
* @see {@link WebFetch_20250910_Args} for the argument schema that consumes this configuration
|
|
1632
|
+
*
|
|
1058
1633
|
* @category Web Fetch
|
|
1059
1634
|
* @since 4.0.0
|
|
1060
1635
|
*/
|
|
@@ -1070,6 +1645,25 @@ export const WebFetchCitationsConfig = /*#__PURE__*/Schema.Struct({
|
|
|
1070
1645
|
/**
|
|
1071
1646
|
* Configuration arguments for the web fetch tool.
|
|
1072
1647
|
*
|
|
1648
|
+
* **When to use**
|
|
1649
|
+
*
|
|
1650
|
+
* Use when configuring `WebFetch_20250910` with usage limits, domain filters,
|
|
1651
|
+
* citations, or content token limits.
|
|
1652
|
+
*
|
|
1653
|
+
* **Details**
|
|
1654
|
+
*
|
|
1655
|
+
* The payload can set `maxUses`, domain filters, `citations`, and
|
|
1656
|
+
* `maxContentTokens`, which map to Anthropic web fetch request fields.
|
|
1657
|
+
*
|
|
1658
|
+
* **Gotchas**
|
|
1659
|
+
*
|
|
1660
|
+
* `allowedDomains` and `blockedDomains` are mutually exclusive.
|
|
1661
|
+
* `maxContentTokens` is approximate and does not apply to binary content such
|
|
1662
|
+
* as PDFs.
|
|
1663
|
+
*
|
|
1664
|
+
* @see {@link WebFetch_20250910} for the provider-defined tool that consumes these arguments
|
|
1665
|
+
* @see {@link WebFetchCitationsConfig} for configuring citations
|
|
1666
|
+
*
|
|
1073
1667
|
* @category Web Fetch
|
|
1074
1668
|
* @since 4.0.0
|
|
1075
1669
|
*/
|
|
@@ -1103,7 +1697,23 @@ export const WebFetch_20250910_Args = /*#__PURE__*/Schema.Struct({
|
|
|
1103
1697
|
// Web Fetch Parameters
|
|
1104
1698
|
// -----------------------------------------------------------------------------
|
|
1105
1699
|
/**
|
|
1106
|
-
*
|
|
1700
|
+
* Schema for Claude-supplied web fetch parameters.
|
|
1701
|
+
*
|
|
1702
|
+
* **When to use**
|
|
1703
|
+
*
|
|
1704
|
+
* Use when validating or constructing the `url` payload consumed by
|
|
1705
|
+
* `WebFetch_20250910`.
|
|
1706
|
+
*
|
|
1707
|
+
* **Details**
|
|
1708
|
+
*
|
|
1709
|
+
* The payload contains the single `url` parameter for Anthropic web fetch.
|
|
1710
|
+
*
|
|
1711
|
+
* **Gotchas**
|
|
1712
|
+
*
|
|
1713
|
+
* The URL must be user-provided or from prior search/fetch results. Maximum URL
|
|
1714
|
+
* length is 250 characters.
|
|
1715
|
+
*
|
|
1716
|
+
* @see {@link WebFetch_20250910} for the provider-defined tool that consumes this payload
|
|
1107
1717
|
*
|
|
1108
1718
|
* @category Web Fetch
|
|
1109
1719
|
* @since 4.0.0
|
|
@@ -1121,11 +1731,17 @@ export const WebFetchParameters = /*#__PURE__*/Schema.Struct({
|
|
|
1121
1731
|
/**
|
|
1122
1732
|
* Web fetch tool for Claude models.
|
|
1123
1733
|
*
|
|
1734
|
+
* **When to use**
|
|
1735
|
+
*
|
|
1736
|
+
* Use when Claude should retrieve the content of a specific web page or PDF.
|
|
1737
|
+
*
|
|
1124
1738
|
* **Details**
|
|
1125
1739
|
*
|
|
1126
1740
|
* Allows Claude to retrieve full content from web pages and PDF documents.
|
|
1127
|
-
* This is a server-side tool executed by Anthropic's infrastructure.
|
|
1128
|
-
*
|
|
1741
|
+
* This is a server-side tool executed by Anthropic's infrastructure. Selecting
|
|
1742
|
+
* this tool adds the "web-fetch-2025-09-10" beta header.
|
|
1743
|
+
*
|
|
1744
|
+
* @see {@link WebSearch_20250305} for discovering URLs before fetching specific content
|
|
1129
1745
|
*
|
|
1130
1746
|
* @category Web Fetch
|
|
1131
1747
|
* @since 4.0.0
|
|
@@ -1165,6 +1781,18 @@ export const ToolSearchRegexParameters = /*#__PURE__*/Schema.Struct({
|
|
|
1165
1781
|
/**
|
|
1166
1782
|
* Input parameters for BM25/natural language tool search.
|
|
1167
1783
|
*
|
|
1784
|
+
* **When to use**
|
|
1785
|
+
*
|
|
1786
|
+
* Use when validating or constructing the natural-language query payload for
|
|
1787
|
+
* `ToolSearchBM25_20251119`.
|
|
1788
|
+
*
|
|
1789
|
+
* **Details**
|
|
1790
|
+
*
|
|
1791
|
+
* The payload contains Claude's natural-language `query`. BM25 searches tool
|
|
1792
|
+
* names, descriptions, argument names, and argument descriptions.
|
|
1793
|
+
*
|
|
1794
|
+
* @see {@link ToolSearchBM25_20251119} for the provider-defined tool that consumes these parameters
|
|
1795
|
+
*
|
|
1168
1796
|
* @category Tool Search
|
|
1169
1797
|
* @since 4.0.0
|
|
1170
1798
|
*/
|
|
@@ -1201,6 +1829,11 @@ export const ToolSearchRegex_20251119 = /*#__PURE__*/Tool.providerDefined({
|
|
|
1201
1829
|
/**
|
|
1202
1830
|
* BM25/natural language tool search for Claude models.
|
|
1203
1831
|
*
|
|
1832
|
+
* **When to use**
|
|
1833
|
+
*
|
|
1834
|
+
* Use when you want Claude to find relevant tools from a natural-language query
|
|
1835
|
+
* instead of a regex pattern.
|
|
1836
|
+
*
|
|
1204
1837
|
* **Details**
|
|
1205
1838
|
*
|
|
1206
1839
|
* Claude uses natural language queries to search for tools using the
|
|
@@ -1208,6 +1841,8 @@ export const ToolSearchRegex_20251119 = /*#__PURE__*/Tool.providerDefined({
|
|
|
1208
1841
|
* argument names, and argument descriptions.
|
|
1209
1842
|
* Requires the "advanced-tool-use-2025-11-20" beta header.
|
|
1210
1843
|
*
|
|
1844
|
+
* @see {@link ToolSearchRegex_20251119} for the regex-pattern alternative
|
|
1845
|
+
*
|
|
1211
1846
|
* @category Tool Search
|
|
1212
1847
|
* @since 4.0.0
|
|
1213
1848
|
*/
|