@effect/ai-anthropic 4.0.0-beta.70 → 4.0.0-beta.72
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 +51 -2
- package/dist/AnthropicClient.d.ts.map +1 -1
- package/dist/AnthropicClient.js +64 -4
- 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 +105 -7
- package/dist/AnthropicLanguageModel.d.ts.map +1 -1
- package/dist/AnthropicLanguageModel.js +55 -5
- 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 +940 -165
- package/dist/AnthropicTool.d.ts.map +1 -1
- package/dist/AnthropicTool.js +760 -123
- 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 +80 -5
- package/src/AnthropicConfig.ts +22 -0
- package/src/AnthropicError.ts +8 -0
- package/src/AnthropicLanguageModel.ts +135 -9
- package/src/AnthropicTelemetry.ts +54 -5
- package/src/AnthropicTool.ts +938 -163
- 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
|
*/
|
|
@@ -13,13 +63,20 @@ import * as Generated from "./Generated.js";
|
|
|
13
63
|
// Bash
|
|
14
64
|
// =============================================================================
|
|
15
65
|
/**
|
|
16
|
-
* Anthropic Bash tool (2024-10-22 version).
|
|
66
|
+
* Defines the Anthropic Bash tool (2024-10-22 version).
|
|
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.
|
|
17
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
|
*/
|
|
@@ -35,13 +92,20 @@ export const Bash_20241022 = /*#__PURE__*/Tool.providerDefined({
|
|
|
35
92
|
})
|
|
36
93
|
});
|
|
37
94
|
/**
|
|
38
|
-
* Anthropic Bash tool (2025-01-24 version).
|
|
95
|
+
* Defines the Anthropic Bash tool (2025-01-24 version).
|
|
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.
|
|
39
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
|
*/
|
|
@@ -162,7 +293,12 @@ export const CodeExecution_20250825_Parameters = /*#__PURE__*/Schema.Struct({
|
|
|
162
293
|
// Code Execution Tool Definitions
|
|
163
294
|
// -----------------------------------------------------------------------------
|
|
164
295
|
/**
|
|
165
|
-
* Anthropic Code Execution tool (2025-05-22 version).
|
|
296
|
+
* Defines the Anthropic Code Execution tool (2025-05-22 version).
|
|
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.
|
|
166
302
|
*
|
|
167
303
|
* **Details**
|
|
168
304
|
*
|
|
@@ -170,6 +306,8 @@ export const CodeExecution_20250825_Parameters = /*#__PURE__*/Schema.Struct({
|
|
|
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
|
*/
|
|
@@ -182,11 +320,20 @@ export const CodeExecution_20250522 = /*#__PURE__*/Tool.providerDefined({
|
|
|
182
320
|
failure: Generated.BetaResponseCodeExecutionToolResultError
|
|
183
321
|
});
|
|
184
322
|
/**
|
|
185
|
-
* Anthropic Code Execution tool (2025-08-25 version).
|
|
323
|
+
* Defines the Anthropic Code Execution tool (2025-08-25 version).
|
|
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.
|
|
186
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,30 +353,54 @@ 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.
|
|
210
362
|
*
|
|
211
|
-
*
|
|
363
|
+
* **Gotchas**
|
|
364
|
+
*
|
|
365
|
+
* This schema validates tuple shape only and does not check display bounds.
|
|
366
|
+
*
|
|
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**
|
|
217
375
|
*
|
|
218
|
-
*
|
|
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.
|
|
382
|
+
*
|
|
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
|
+
* Schema for scroll direction literals: `"up"`, `"down"`, `"left"`, or `"right"`.
|
|
389
|
+
*
|
|
390
|
+
* @see {@link ComputerUseScrollAction} for the action payload that consumes this schema
|
|
224
391
|
*
|
|
225
|
-
* @category
|
|
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
|
-
*
|
|
397
|
+
* Schema for modifier key literals.
|
|
231
398
|
*
|
|
232
|
-
*
|
|
399
|
+
* **Details**
|
|
400
|
+
*
|
|
401
|
+
* Allowed values are `"alt"`, `"ctrl"`, `"meta"`, and `"shift"`.
|
|
402
|
+
*
|
|
403
|
+
* @category computer use
|
|
233
404
|
* @since 4.0.0
|
|
234
405
|
*/
|
|
235
406
|
export const ModifierKey = /*#__PURE__*/Schema.Literals(["alt", "ctrl", "meta", "shift"]);
|
|
@@ -260,9 +431,18 @@ 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**
|
|
264
438
|
*
|
|
265
|
-
*
|
|
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
|
|
444
|
+
*
|
|
445
|
+
* @category computer use
|
|
266
446
|
* @since 4.0.0
|
|
267
447
|
*/
|
|
268
448
|
export const ComputerUseKeyAction = /*#__PURE__*/Schema.Struct({
|
|
@@ -273,9 +453,29 @@ 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**
|
|
277
470
|
*
|
|
278
|
-
*
|
|
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
|
|
477
|
+
*
|
|
478
|
+
* @category computer use
|
|
279
479
|
* @since 4.0.0
|
|
280
480
|
*/
|
|
281
481
|
export const ComputerUseLeftClickAction = /*#__PURE__*/Schema.Struct({
|
|
@@ -287,9 +487,26 @@ 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
|
-
* @category
|
|
509
|
+
* @category computer use
|
|
293
510
|
* @since 4.0.0
|
|
294
511
|
*/
|
|
295
512
|
export const ComputerUseMouseMoveAction = /*#__PURE__*/Schema.Struct({
|
|
@@ -300,18 +517,42 @@ 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.
|
|
304
521
|
*
|
|
305
|
-
*
|
|
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
|
|
533
|
+
*
|
|
534
|
+
* @category computer use
|
|
306
535
|
* @since 4.0.0
|
|
307
536
|
*/
|
|
308
537
|
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.
|
|
313
547
|
*
|
|
314
|
-
*
|
|
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
|
|
554
|
+
*
|
|
555
|
+
* @category computer use
|
|
315
556
|
* @since 4.0.0
|
|
316
557
|
*/
|
|
317
558
|
export const TypeAction = /*#__PURE__*/Schema.Struct({
|
|
@@ -326,9 +567,28 @@ 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.
|
|
330
582
|
*
|
|
331
|
-
*
|
|
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
|
|
590
|
+
*
|
|
591
|
+
* @category computer use
|
|
332
592
|
* @since 4.0.0
|
|
333
593
|
*/
|
|
334
594
|
export const ComputerUseDoubleClickAction = /*#__PURE__*/Schema.Struct({
|
|
@@ -340,9 +600,28 @@ export const ComputerUseDoubleClickAction = /*#__PURE__*/Schema.Struct({
|
|
|
340
600
|
coordinate: /*#__PURE__*/Schema.optional(Coordinate)
|
|
341
601
|
});
|
|
342
602
|
/**
|
|
343
|
-
*
|
|
603
|
+
* Keeps a key pressed for a specified duration during computer-use execution.
|
|
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.
|
|
344
615
|
*
|
|
345
|
-
*
|
|
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
|
+
*
|
|
624
|
+
* @category computer use
|
|
346
625
|
* @since 4.0.0
|
|
347
626
|
*/
|
|
348
627
|
export const ComputerUseHoldKeyAction = /*#__PURE__*/Schema.Struct({
|
|
@@ -357,9 +636,28 @@ 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.
|
|
361
650
|
*
|
|
362
|
-
*
|
|
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
|
|
659
|
+
*
|
|
660
|
+
* @category computer use
|
|
363
661
|
* @since 4.0.0
|
|
364
662
|
*/
|
|
365
663
|
export const ComputerUseLeftClickDragAction = /*#__PURE__*/Schema.Struct({
|
|
@@ -374,13 +672,14 @@ export const ComputerUseLeftClickDragAction = /*#__PURE__*/Schema.Struct({
|
|
|
374
672
|
coordinate: Coordinate
|
|
375
673
|
});
|
|
376
674
|
/**
|
|
377
|
-
*
|
|
675
|
+
* Starts a left mouse button press without releasing it.
|
|
378
676
|
*
|
|
379
677
|
* **When to use**
|
|
380
678
|
*
|
|
381
|
-
* Use
|
|
679
|
+
* Use when constructing a manual click or drag sequence that should press and
|
|
680
|
+
* hold the left mouse button before a later release.
|
|
382
681
|
*
|
|
383
|
-
* @category
|
|
682
|
+
* @category computer use
|
|
384
683
|
* @since 4.0.0
|
|
385
684
|
*/
|
|
386
685
|
export const ComputerUseLeftMouseDownAction = /*#__PURE__*/Schema.Struct({
|
|
@@ -392,13 +691,14 @@ export const ComputerUseLeftMouseDownAction = /*#__PURE__*/Schema.Struct({
|
|
|
392
691
|
coordinate: /*#__PURE__*/Schema.optional(Coordinate)
|
|
393
692
|
});
|
|
394
693
|
/**
|
|
395
|
-
*
|
|
694
|
+
* Releases the left mouse button.
|
|
396
695
|
*
|
|
397
696
|
* **When to use**
|
|
398
697
|
*
|
|
399
|
-
* Use
|
|
698
|
+
* Use when constructing a manual click or drag sequence that should release the
|
|
699
|
+
* left mouse button after it was previously held down.
|
|
400
700
|
*
|
|
401
|
-
* @category
|
|
701
|
+
* @category computer use
|
|
402
702
|
* @since 4.0.0
|
|
403
703
|
*/
|
|
404
704
|
export const ComputerUseLeftMouseUpAction = /*#__PURE__*/Schema.Struct({
|
|
@@ -410,9 +710,28 @@ export const ComputerUseLeftMouseUpAction = /*#__PURE__*/Schema.Struct({
|
|
|
410
710
|
coordinate: /*#__PURE__*/Schema.optional(Coordinate)
|
|
411
711
|
});
|
|
412
712
|
/**
|
|
413
|
-
*
|
|
713
|
+
* Schema for a computer-use action that performs a middle click.
|
|
714
|
+
*
|
|
715
|
+
* **When to use**
|
|
716
|
+
*
|
|
717
|
+
* Use to validate or construct a middle-button click action for Anthropic
|
|
718
|
+
* computer use, optionally targeting a specific screen coordinate.
|
|
719
|
+
*
|
|
720
|
+
* **Details**
|
|
721
|
+
*
|
|
722
|
+
* The payload must use `action: "middle_click"`. When `coordinate` is omitted,
|
|
723
|
+
* the click occurs at the current mouse position.
|
|
414
724
|
*
|
|
415
|
-
*
|
|
725
|
+
* **Gotchas**
|
|
726
|
+
*
|
|
727
|
+
* This action is available in the 2025-01-24 computer-use action set and later;
|
|
728
|
+
* it is not part of `ComputerUse_20241022`.
|
|
729
|
+
*
|
|
730
|
+
* @see {@link ComputerUse_20250124} for the provider-defined tool version that first accepts this action
|
|
731
|
+
* @see {@link ComputerUseLeftClickAction} for primary-button clicks
|
|
732
|
+
* @see {@link ComputerUseRightClickAction} for secondary-button clicks
|
|
733
|
+
*
|
|
734
|
+
* @category computer use
|
|
416
735
|
* @since 4.0.0
|
|
417
736
|
*/
|
|
418
737
|
export const ComputerUseMiddleClickAction = /*#__PURE__*/Schema.Struct({
|
|
@@ -424,9 +743,24 @@ export const ComputerUseMiddleClickAction = /*#__PURE__*/Schema.Struct({
|
|
|
424
743
|
coordinate: /*#__PURE__*/Schema.optional(Coordinate)
|
|
425
744
|
});
|
|
426
745
|
/**
|
|
427
|
-
*
|
|
746
|
+
* Schema for a computer-use action that performs a right click, optionally at a
|
|
747
|
+
* specific screen coordinate.
|
|
748
|
+
*
|
|
749
|
+
* **When to use**
|
|
750
|
+
*
|
|
751
|
+
* Use to validate or construct the `right_click` action for an Anthropic
|
|
752
|
+
* computer-use tool call.
|
|
753
|
+
*
|
|
754
|
+
* **Details**
|
|
755
|
+
*
|
|
756
|
+
* The optional `coordinate` field is an `[x, y]` screen coordinate in pixels.
|
|
757
|
+
* When omitted, the right click is performed at the current mouse position.
|
|
428
758
|
*
|
|
429
|
-
* @
|
|
759
|
+
* @see {@link ComputerUse_20250124} for the provider-defined computer-use tool version that introduced this action
|
|
760
|
+
* @see {@link ComputerUseLeftClickAction} for the corresponding left-click action
|
|
761
|
+
* @see {@link ComputerUseMiddleClickAction} for the corresponding middle-click action
|
|
762
|
+
*
|
|
763
|
+
* @category computer use
|
|
430
764
|
* @since 4.0.0
|
|
431
765
|
*/
|
|
432
766
|
export const ComputerUseRightClickAction = /*#__PURE__*/Schema.Struct({
|
|
@@ -438,9 +772,26 @@ export const ComputerUseRightClickAction = /*#__PURE__*/Schema.Struct({
|
|
|
438
772
|
coordinate: /*#__PURE__*/Schema.optional(Coordinate)
|
|
439
773
|
});
|
|
440
774
|
/**
|
|
441
|
-
*
|
|
775
|
+
* Schema for a computer-use scroll action.
|
|
776
|
+
*
|
|
777
|
+
* **When to use**
|
|
778
|
+
*
|
|
779
|
+
* Use when validating or constructing Anthropic computer-use scroll payloads.
|
|
780
|
+
*
|
|
781
|
+
* **Details**
|
|
782
|
+
*
|
|
783
|
+
* The encoded payload uses `action: "scroll"`, an optional `coordinate`,
|
|
784
|
+
* `scroll_direction`, and `scroll_amount`.
|
|
785
|
+
*
|
|
786
|
+
* **Gotchas**
|
|
787
|
+
*
|
|
788
|
+
* `coordinate` only checks a two-number tuple, and `scroll_amount` is only
|
|
789
|
+
* `Schema.Number`.
|
|
442
790
|
*
|
|
443
|
-
* @
|
|
791
|
+
* @see {@link ComputerUse_20250124} for the tool version that accepts this action
|
|
792
|
+
* @see {@link ScrollDirection} for the accepted direction literals
|
|
793
|
+
*
|
|
794
|
+
* @category computer use
|
|
444
795
|
* @since 4.0.0
|
|
445
796
|
*/
|
|
446
797
|
export const ComputerUseScrollAction = /*#__PURE__*/Schema.Struct({
|
|
@@ -460,9 +811,28 @@ export const ComputerUseScrollAction = /*#__PURE__*/Schema.Struct({
|
|
|
460
811
|
scroll_amount: Schema.Number
|
|
461
812
|
});
|
|
462
813
|
/**
|
|
463
|
-
*
|
|
814
|
+
* Schema for a computer-use triple-click action.
|
|
815
|
+
*
|
|
816
|
+
* **When to use**
|
|
817
|
+
*
|
|
818
|
+
* Use when validating or constructing Anthropic computer-use triple-click
|
|
819
|
+
* payloads at the current pointer position or an optional coordinate.
|
|
820
|
+
*
|
|
821
|
+
* **Details**
|
|
822
|
+
*
|
|
823
|
+
* The encoded payload uses `action: "triple_click"` and an optional
|
|
824
|
+
* `coordinate`.
|
|
825
|
+
*
|
|
826
|
+
* **Gotchas**
|
|
827
|
+
*
|
|
828
|
+
* `coordinate` only validates as a two-number tuple and does not check display
|
|
829
|
+
* bounds.
|
|
830
|
+
*
|
|
831
|
+
* @see {@link ComputerUse_20250124} for the tool version that accepts this action
|
|
832
|
+
* @see {@link ComputerUseDoubleClickAction} for the two-click variant
|
|
833
|
+
* @see {@link ComputerUseLeftClickAction} for a single left click
|
|
464
834
|
*
|
|
465
|
-
* @category
|
|
835
|
+
* @category computer use
|
|
466
836
|
* @since 4.0.0
|
|
467
837
|
*/
|
|
468
838
|
export const ComputerUseTripleClickAction = /*#__PURE__*/Schema.Struct({
|
|
@@ -474,9 +844,27 @@ export const ComputerUseTripleClickAction = /*#__PURE__*/Schema.Struct({
|
|
|
474
844
|
coordinate: /*#__PURE__*/Schema.optional(Coordinate)
|
|
475
845
|
});
|
|
476
846
|
/**
|
|
477
|
-
*
|
|
847
|
+
* Schema for a computer-use wait action.
|
|
848
|
+
*
|
|
849
|
+
* **When to use**
|
|
850
|
+
*
|
|
851
|
+
* Use when validating or constructing Anthropic computer-use payloads that pause
|
|
852
|
+
* between actions.
|
|
853
|
+
*
|
|
854
|
+
* **Details**
|
|
855
|
+
*
|
|
856
|
+
* The encoded payload uses `action: "wait"` and a required `duration` in
|
|
857
|
+
* seconds.
|
|
858
|
+
*
|
|
859
|
+
* **Gotchas**
|
|
860
|
+
*
|
|
861
|
+
* `duration` is only `Schema.Number`; it is not constrained to positive or
|
|
862
|
+
* finite values.
|
|
863
|
+
*
|
|
864
|
+
* @see {@link ComputerUseHoldKeyAction} for another duration-based computer-use action
|
|
865
|
+
* @see {@link ComputerUse_20250124} for the tool version that accepts this action
|
|
478
866
|
*
|
|
479
|
-
* @category
|
|
867
|
+
* @category computer use
|
|
480
868
|
* @since 4.0.0
|
|
481
869
|
*/
|
|
482
870
|
export const ComputerUseWaitAction = /*#__PURE__*/Schema.Struct({
|
|
@@ -491,13 +879,21 @@ const ComputerUse_20250124_Actions = /*#__PURE__*/Schema.Union([...ComputerUse_2
|
|
|
491
879
|
// Computer Use 20251124 Actions
|
|
492
880
|
// -----------------------------------------------------------------------------
|
|
493
881
|
/**
|
|
494
|
-
*
|
|
882
|
+
* Zooms into a specific region of the screen at full resolution.
|
|
495
883
|
*
|
|
496
884
|
* **Details**
|
|
497
885
|
*
|
|
498
|
-
*
|
|
886
|
+
* The encoded payload uses `action: "zoom"` and a `region` tuple.
|
|
499
887
|
*
|
|
500
|
-
*
|
|
888
|
+
* **Gotchas**
|
|
889
|
+
*
|
|
890
|
+
* Requires `enableZoom: true` in the tool definition. `region` is only a
|
|
891
|
+
* four-number tuple and does not validate corner ordering or display bounds.
|
|
892
|
+
*
|
|
893
|
+
* @see {@link ComputerUse_20251124} for the tool version that accepts this action
|
|
894
|
+
* @see {@link ComputerUseScreenshotAction} for capturing the full screen instead
|
|
895
|
+
*
|
|
896
|
+
* @category computer use
|
|
501
897
|
* @since 4.0.0
|
|
502
898
|
*/
|
|
503
899
|
export const ComputerUseZoomAction = /*#__PURE__*/Schema.Struct({
|
|
@@ -513,14 +909,14 @@ const ComputerUse_20251124_Actions = /*#__PURE__*/Schema.Union([...ComputerUse_2
|
|
|
513
909
|
// Computer Use Tool Definitions
|
|
514
910
|
// -----------------------------------------------------------------------------
|
|
515
911
|
/**
|
|
516
|
-
*
|
|
912
|
+
* Defines the deprecated computer-use tool for Claude 3.5 Sonnet v2.
|
|
517
913
|
*
|
|
518
914
|
* **Details**
|
|
519
915
|
*
|
|
520
916
|
* Requires the "computer-use-2024-10-22" beta header.
|
|
521
917
|
* Basic actions only: screenshot, left_click, type, key, mouse_move.
|
|
522
918
|
*
|
|
523
|
-
* @category
|
|
919
|
+
* @category computer use
|
|
524
920
|
* @since 4.0.0
|
|
525
921
|
*/
|
|
526
922
|
export const ComputerUse_20241022 = /*#__PURE__*/Tool.providerDefined({
|
|
@@ -533,7 +929,12 @@ export const ComputerUse_20241022 = /*#__PURE__*/Tool.providerDefined({
|
|
|
533
929
|
success: Schema.String
|
|
534
930
|
});
|
|
535
931
|
/**
|
|
536
|
-
*
|
|
932
|
+
* Defines the computer-use tool for Claude 4 models and Claude Sonnet 3.7.
|
|
933
|
+
*
|
|
934
|
+
* **When to use**
|
|
935
|
+
*
|
|
936
|
+
* Use when configuring Anthropic computer use for Claude 4 models or Claude
|
|
937
|
+
* Sonnet 3.7 with the 2025-01-24 action set.
|
|
537
938
|
*
|
|
538
939
|
* **Details**
|
|
539
940
|
*
|
|
@@ -542,7 +943,10 @@ export const ComputerUse_20241022 = /*#__PURE__*/Tool.providerDefined({
|
|
|
542
943
|
* right_click, middle_click, double_click, triple_click, left_mouse_down,
|
|
543
944
|
* left_mouse_up, hold_key, wait.
|
|
544
945
|
*
|
|
545
|
-
* @
|
|
946
|
+
* @see {@link ComputerUse_20241022} for the older basic action set
|
|
947
|
+
* @see {@link ComputerUse_20251124} for the newer zoom-capable version
|
|
948
|
+
*
|
|
949
|
+
* @category computer use
|
|
546
950
|
* @since 4.0.0
|
|
547
951
|
*/
|
|
548
952
|
export const ComputerUse_20250124 = /*#__PURE__*/Tool.providerDefined({
|
|
@@ -555,15 +959,27 @@ export const ComputerUse_20250124 = /*#__PURE__*/Tool.providerDefined({
|
|
|
555
959
|
success: Schema.String
|
|
556
960
|
});
|
|
557
961
|
/**
|
|
558
|
-
*
|
|
962
|
+
* Defines the computer-use tool for Claude Opus 4.5 only.
|
|
963
|
+
*
|
|
964
|
+
* **When to use**
|
|
965
|
+
*
|
|
966
|
+
* Use when configuring Anthropic computer use for Claude Opus 4.5 with the
|
|
967
|
+
* 2025-11-24 action set and zoom-capable screen inspection.
|
|
559
968
|
*
|
|
560
969
|
* **Details**
|
|
561
970
|
*
|
|
562
971
|
* Requires the "computer-use-2025-11-24" beta header.
|
|
563
972
|
* Includes all actions from computer_20250124 plus the zoom action for
|
|
564
|
-
* detailed screen region inspection.
|
|
973
|
+
* detailed screen region inspection.
|
|
974
|
+
*
|
|
975
|
+
* **Gotchas**
|
|
976
|
+
*
|
|
977
|
+
* Zoom actions require `enableZoom: true` in args.
|
|
978
|
+
*
|
|
979
|
+
* @see {@link ComputerUse_20250124} for the previous action set without zoom
|
|
980
|
+
* @see {@link ComputerUseZoomAction} for the zoom action payload
|
|
565
981
|
*
|
|
566
|
-
* @category
|
|
982
|
+
* @category computer use
|
|
567
983
|
* @since 4.0.0
|
|
568
984
|
*/
|
|
569
985
|
export const ComputerUse_20251124 = /*#__PURE__*/Tool.providerDefined({
|
|
@@ -582,15 +998,23 @@ export const ComputerUse_20251124 = /*#__PURE__*/Tool.providerDefined({
|
|
|
582
998
|
// Common Types
|
|
583
999
|
// -----------------------------------------------------------------------------
|
|
584
1000
|
/**
|
|
585
|
-
*
|
|
1001
|
+
* Defines a `[start, end]` line range for viewing file contents.
|
|
1002
|
+
*
|
|
1003
|
+
* **When to use**
|
|
1004
|
+
*
|
|
1005
|
+
* Use when constructing or validating `view_range` for memory or text editor
|
|
1006
|
+
* view commands.
|
|
586
1007
|
*
|
|
587
1008
|
* **Details**
|
|
588
1009
|
*
|
|
589
|
-
* Lines are 1-indexed. Use
|
|
1010
|
+
* Lines are 1-indexed. Use `-1` for end to read to the end of the file. For
|
|
590
1011
|
* example, `[1, 50]` views lines 1-50 and `[100, -1]` views from line 100 to
|
|
591
1012
|
* the end of the file.
|
|
592
1013
|
*
|
|
593
|
-
* @
|
|
1014
|
+
* @see {@link MemoryViewCommand} for memory view payloads that use this range
|
|
1015
|
+
* @see {@link TextEditorViewCommand} for text editor view payloads that use this range
|
|
1016
|
+
*
|
|
1017
|
+
* @category memory
|
|
594
1018
|
* @since 4.0.0
|
|
595
1019
|
*/
|
|
596
1020
|
export const ViewRange = /*#__PURE__*/Schema.Tuple([Schema.Number, Schema.Number]);
|
|
@@ -598,9 +1022,13 @@ export const ViewRange = /*#__PURE__*/Schema.Tuple([Schema.Number, Schema.Number
|
|
|
598
1022
|
// Memory 20250818 Commands
|
|
599
1023
|
// -----------------------------------------------------------------------------
|
|
600
1024
|
/**
|
|
601
|
-
*
|
|
1025
|
+
* Schema for the memory tool command that creates a new file at a path.
|
|
602
1026
|
*
|
|
603
|
-
*
|
|
1027
|
+
* **Details**
|
|
1028
|
+
*
|
|
1029
|
+
* The payload contains `command: "create"` and a `path` string.
|
|
1030
|
+
*
|
|
1031
|
+
* @category memory
|
|
604
1032
|
* @since 4.0.0
|
|
605
1033
|
*/
|
|
606
1034
|
export const MemoryCreateCommand = /*#__PURE__*/Schema.Struct({
|
|
@@ -611,22 +1039,34 @@ export const MemoryCreateCommand = /*#__PURE__*/Schema.Struct({
|
|
|
611
1039
|
path: Schema.String
|
|
612
1040
|
});
|
|
613
1041
|
/**
|
|
614
|
-
*
|
|
1042
|
+
* Schema for a memory command that deletes a file or directory.
|
|
615
1043
|
*
|
|
616
|
-
* @category
|
|
1044
|
+
* @category memory
|
|
617
1045
|
* @since 4.0.0
|
|
618
1046
|
*/
|
|
619
1047
|
export const MemoryDeleteCommand = /*#__PURE__*/Schema.Struct({
|
|
620
1048
|
command: /*#__PURE__*/Schema.Literal("delete"),
|
|
621
1049
|
/**
|
|
622
|
-
* The path to the file to delete.
|
|
1050
|
+
* The path to the file or directory to delete.
|
|
623
1051
|
*/
|
|
624
1052
|
path: Schema.String
|
|
625
1053
|
});
|
|
626
1054
|
/**
|
|
627
|
-
*
|
|
1055
|
+
* Schema for the memory `insert` command.
|
|
1056
|
+
*
|
|
1057
|
+
* **When to use**
|
|
1058
|
+
*
|
|
1059
|
+
* Use when validating or constructing `insert` payloads for `Memory_20250818`.
|
|
628
1060
|
*
|
|
629
|
-
*
|
|
1061
|
+
* **Details**
|
|
1062
|
+
*
|
|
1063
|
+
* The payload is discriminated by `command: "insert"` and requires `path`,
|
|
1064
|
+
* `insert_line`, and `insert_text`.
|
|
1065
|
+
*
|
|
1066
|
+
* @see {@link Memory_20250818} for the provider-defined tool that consumes this command
|
|
1067
|
+
* @see {@link MemoryStrReplaceCommand} for replacing existing text instead
|
|
1068
|
+
*
|
|
1069
|
+
* @category memory
|
|
630
1070
|
* @since 4.0.0
|
|
631
1071
|
*/
|
|
632
1072
|
export const MemoryInsertCommand = /*#__PURE__*/Schema.Struct({
|
|
@@ -645,9 +1085,14 @@ export const MemoryInsertCommand = /*#__PURE__*/Schema.Struct({
|
|
|
645
1085
|
insert_text: Schema.String
|
|
646
1086
|
});
|
|
647
1087
|
/**
|
|
648
|
-
*
|
|
1088
|
+
* Schema for the memory command that renames or moves a file or directory.
|
|
1089
|
+
*
|
|
1090
|
+
* **Details**
|
|
1091
|
+
*
|
|
1092
|
+
* The payload uses `command: "rename"` and requires `old_path` as the current
|
|
1093
|
+
* path plus `new_path` as the new destination path.
|
|
649
1094
|
*
|
|
650
|
-
* @category
|
|
1095
|
+
* @category memory
|
|
651
1096
|
* @since 4.0.0
|
|
652
1097
|
*/
|
|
653
1098
|
export const MemoryRenameCommand = /*#__PURE__*/Schema.Struct({
|
|
@@ -662,9 +1107,21 @@ export const MemoryRenameCommand = /*#__PURE__*/Schema.Struct({
|
|
|
662
1107
|
new_path: Schema.String
|
|
663
1108
|
});
|
|
664
1109
|
/**
|
|
665
|
-
*
|
|
1110
|
+
* Schema for the memory `str_replace` command.
|
|
1111
|
+
*
|
|
1112
|
+
* **When to use**
|
|
1113
|
+
*
|
|
1114
|
+
* Use when validating or constructing `str_replace` payloads for
|
|
1115
|
+
* `Memory_20250818`.
|
|
666
1116
|
*
|
|
667
|
-
*
|
|
1117
|
+
* **Details**
|
|
1118
|
+
*
|
|
1119
|
+
* The payload is discriminated by `command: "str_replace"` and requires `path`,
|
|
1120
|
+
* `old_str`, and `new_str`.
|
|
1121
|
+
*
|
|
1122
|
+
* @see {@link Memory_20250818} for the provider-defined tool that consumes this command
|
|
1123
|
+
*
|
|
1124
|
+
* @category memory
|
|
668
1125
|
* @since 4.0.0
|
|
669
1126
|
*/
|
|
670
1127
|
export const MemoryStrReplaceCommand = /*#__PURE__*/Schema.Struct({
|
|
@@ -685,13 +1142,18 @@ export const MemoryStrReplaceCommand = /*#__PURE__*/Schema.Struct({
|
|
|
685
1142
|
/**
|
|
686
1143
|
* Shows directory contents or file contents with optional line ranges.
|
|
687
1144
|
*
|
|
688
|
-
*
|
|
1145
|
+
* **Details**
|
|
1146
|
+
*
|
|
1147
|
+
* When used on a file, returns file contents optionally limited by `view_range`.
|
|
1148
|
+
* When used on a directory, lists contents.
|
|
1149
|
+
*
|
|
1150
|
+
* @category memory
|
|
689
1151
|
* @since 4.0.0
|
|
690
1152
|
*/
|
|
691
1153
|
export const MemoryViewCommand = /*#__PURE__*/Schema.Struct({
|
|
692
1154
|
command: /*#__PURE__*/Schema.Literal("view"),
|
|
693
1155
|
/**
|
|
694
|
-
* The path to the file to view.
|
|
1156
|
+
* The path to the file or directory to view.
|
|
695
1157
|
*/
|
|
696
1158
|
path: Schema.String,
|
|
697
1159
|
/**
|
|
@@ -704,14 +1166,14 @@ const Memory_20250818_Commands = /*#__PURE__*/Schema.Union([MemoryCreateCommand,
|
|
|
704
1166
|
// Memory Tool Definitions
|
|
705
1167
|
// -----------------------------------------------------------------------------
|
|
706
1168
|
/**
|
|
707
|
-
*
|
|
1169
|
+
* Defines the memory tool for persistent file operations across conversations.
|
|
708
1170
|
*
|
|
709
1171
|
* **Details**
|
|
710
1172
|
*
|
|
711
1173
|
* Provides commands for creating, viewing, editing, renaming, and deleting
|
|
712
1174
|
* files within the model's memory space.
|
|
713
1175
|
*
|
|
714
|
-
* @category
|
|
1176
|
+
* @category memory
|
|
715
1177
|
* @since 4.0.0
|
|
716
1178
|
*/
|
|
717
1179
|
export const Memory_20250818 = /*#__PURE__*/Tool.providerDefined({
|
|
@@ -728,14 +1190,23 @@ export const Memory_20250818 = /*#__PURE__*/Tool.providerDefined({
|
|
|
728
1190
|
// Text Editor Commands
|
|
729
1191
|
// -----------------------------------------------------------------------------
|
|
730
1192
|
/**
|
|
731
|
-
*
|
|
1193
|
+
* Reads the contents of a file or lists directory contents.
|
|
1194
|
+
*
|
|
1195
|
+
* **When to use**
|
|
1196
|
+
*
|
|
1197
|
+
* Use when validating or constructing the standalone Anthropic Text Editor
|
|
1198
|
+
* `view` command.
|
|
732
1199
|
*
|
|
733
1200
|
* **Details**
|
|
734
1201
|
*
|
|
735
1202
|
* When used on a file, returns the file contents, optionally limited to a line
|
|
736
1203
|
* range. When used on a directory, lists all files and subdirectories.
|
|
1204
|
+
* `view_range` is a 1-indexed `[start, end]` tuple where `-1` means through
|
|
1205
|
+
* the end of the file.
|
|
1206
|
+
*
|
|
1207
|
+
* @see {@link CodeExecutionTextEditorView} for the code-execution variant without `view_range`
|
|
737
1208
|
*
|
|
738
|
-
* @category
|
|
1209
|
+
* @category text editor
|
|
739
1210
|
* @since 4.0.0
|
|
740
1211
|
*/
|
|
741
1212
|
export const TextEditorViewCommand = /*#__PURE__*/Schema.Struct({
|
|
@@ -753,11 +1224,21 @@ export const TextEditorViewCommand = /*#__PURE__*/Schema.Struct({
|
|
|
753
1224
|
/**
|
|
754
1225
|
* Create a new file with specified content.
|
|
755
1226
|
*
|
|
1227
|
+
* **When to use**
|
|
1228
|
+
*
|
|
1229
|
+
* Use when validating or constructing an Anthropic text editor `create`
|
|
1230
|
+
* command.
|
|
1231
|
+
*
|
|
1232
|
+
* **Details**
|
|
1233
|
+
*
|
|
1234
|
+
* The payload is discriminated by `command: "create"` and requires both `path`
|
|
1235
|
+
* and `file_text`.
|
|
1236
|
+
*
|
|
756
1237
|
* **Gotchas**
|
|
757
1238
|
*
|
|
758
1239
|
* Fails if the file already exists. Parent directories must exist.
|
|
759
1240
|
*
|
|
760
|
-
* @category
|
|
1241
|
+
* @category text editor
|
|
761
1242
|
* @since 4.0.0
|
|
762
1243
|
*/
|
|
763
1244
|
export const TextEditorCreateCommand = /*#__PURE__*/Schema.Struct({
|
|
@@ -772,14 +1253,27 @@ export const TextEditorCreateCommand = /*#__PURE__*/Schema.Struct({
|
|
|
772
1253
|
file_text: Schema.String
|
|
773
1254
|
});
|
|
774
1255
|
/**
|
|
775
|
-
*
|
|
1256
|
+
* Replaces a specific string in a file with a new string.
|
|
1257
|
+
*
|
|
1258
|
+
* **When to use**
|
|
1259
|
+
*
|
|
1260
|
+
* Use when validating or constructing standalone Anthropic text editor
|
|
1261
|
+
* `str_replace` commands.
|
|
1262
|
+
*
|
|
1263
|
+
* **Details**
|
|
1264
|
+
*
|
|
1265
|
+
* The payload uses `command: "str_replace"`, `path`, `old_str`, and `new_str`.
|
|
1266
|
+
* `new_str` may be empty to delete text.
|
|
776
1267
|
*
|
|
777
1268
|
* **Gotchas**
|
|
778
1269
|
*
|
|
779
1270
|
* The `old_str` must match exactly (including whitespace and indentation)
|
|
780
1271
|
* and must be unique in the file.
|
|
781
1272
|
*
|
|
782
|
-
* @
|
|
1273
|
+
* @see {@link TextEditorViewCommand} for reading contents before choosing `old_str`
|
|
1274
|
+
* @see {@link CodeExecutionTextEditorStrReplace} for the code-execution variant
|
|
1275
|
+
*
|
|
1276
|
+
* @category text editor
|
|
783
1277
|
* @since 4.0.0
|
|
784
1278
|
*/
|
|
785
1279
|
export const TextEditorStrReplaceCommand = /*#__PURE__*/Schema.Struct({
|
|
@@ -798,13 +1292,14 @@ export const TextEditorStrReplaceCommand = /*#__PURE__*/Schema.Struct({
|
|
|
798
1292
|
new_str: Schema.String
|
|
799
1293
|
});
|
|
800
1294
|
/**
|
|
801
|
-
*
|
|
1295
|
+
* Inserts text at a specific line number in a file.
|
|
802
1296
|
*
|
|
803
1297
|
* **Details**
|
|
804
1298
|
*
|
|
805
|
-
* Inserts the new text
|
|
1299
|
+
* Inserts the new text after the specified line number. Use `0` to insert at
|
|
1300
|
+
* the beginning of the file; other values are 1-indexed.
|
|
806
1301
|
*
|
|
807
|
-
* @category
|
|
1302
|
+
* @category text editor
|
|
808
1303
|
* @since 4.0.0
|
|
809
1304
|
*/
|
|
810
1305
|
export const TextEditorInsertCommand = /*#__PURE__*/Schema.Struct({
|
|
@@ -823,18 +1318,20 @@ export const TextEditorInsertCommand = /*#__PURE__*/Schema.Struct({
|
|
|
823
1318
|
new_str: Schema.String
|
|
824
1319
|
});
|
|
825
1320
|
/**
|
|
826
|
-
*
|
|
1321
|
+
* Undoes the last edit made to a file.
|
|
827
1322
|
*
|
|
828
1323
|
* **Details**
|
|
829
1324
|
*
|
|
830
|
-
* Reverts the most recent str_replace
|
|
1325
|
+
* Reverts the most recent `str_replace`, `insert`, or `create` operation on the
|
|
1326
|
+
* file.
|
|
831
1327
|
*
|
|
832
1328
|
* **Gotchas**
|
|
833
1329
|
*
|
|
834
|
-
* This command is available in text_editor_20241022 and
|
|
835
|
-
* but not in
|
|
1330
|
+
* This command is available in `text_editor_20241022` and
|
|
1331
|
+
* `text_editor_20250124`, but not in `text_editor_20250429` or
|
|
1332
|
+
* `text_editor_20250728`.
|
|
836
1333
|
*
|
|
837
|
-
* @category
|
|
1334
|
+
* @category text editor
|
|
838
1335
|
* @since 4.0.0
|
|
839
1336
|
*/
|
|
840
1337
|
export const TextEditorUndoEditCommand = /*#__PURE__*/Schema.Struct({
|
|
@@ -860,13 +1357,22 @@ const TextEditor_StrReplaceBasedEdit_Args = /*#__PURE__*/Schema.Struct({
|
|
|
860
1357
|
// Text Editor Tool Definitions
|
|
861
1358
|
// -----------------------------------------------------------------------------
|
|
862
1359
|
/**
|
|
863
|
-
*
|
|
1360
|
+
* Defines the deprecated text editor tool for Claude 3.5 Sonnet.
|
|
1361
|
+
*
|
|
1362
|
+
* **When to use**
|
|
1363
|
+
*
|
|
1364
|
+
* Use when configuring the 2024-10-22 `str_replace_editor` compatibility path
|
|
1365
|
+
* for Claude 3.5 Sonnet.
|
|
864
1366
|
*
|
|
865
1367
|
* **Details**
|
|
866
1368
|
*
|
|
867
|
-
* Requires the "computer-use-2024-10-22" beta header
|
|
1369
|
+
* Requires the "computer-use-2024-10-22" beta header and supports `view`,
|
|
1370
|
+
* `create`, `str_replace`, `insert`, and `undo_edit` commands.
|
|
1371
|
+
*
|
|
1372
|
+
* @see {@link TextEditor_20250124} for the newer `str_replace_editor` version
|
|
1373
|
+
* @see {@link TextEditor_20250728} for the Claude 4 `str_replace_based_edit_tool` line
|
|
868
1374
|
*
|
|
869
|
-
* @category
|
|
1375
|
+
* @category text editor
|
|
870
1376
|
* @since 4.0.0
|
|
871
1377
|
*/
|
|
872
1378
|
export const TextEditor_20241022 = /*#__PURE__*/Tool.providerDefined({
|
|
@@ -878,13 +1384,22 @@ export const TextEditor_20241022 = /*#__PURE__*/Tool.providerDefined({
|
|
|
878
1384
|
success: Schema.String
|
|
879
1385
|
});
|
|
880
1386
|
/**
|
|
881
|
-
*
|
|
1387
|
+
* Defines the text editor tool for deprecated Claude Sonnet 3.7.
|
|
1388
|
+
*
|
|
1389
|
+
* **When to use**
|
|
1390
|
+
*
|
|
1391
|
+
* Use when configuring the 2025-01-24 Claude Sonnet 3.7 text editor tool using
|
|
1392
|
+
* `str_replace_editor`.
|
|
882
1393
|
*
|
|
883
1394
|
* **Details**
|
|
884
1395
|
*
|
|
885
|
-
* Requires the "computer-use-2025-01-24" beta header
|
|
1396
|
+
* Requires the "computer-use-2025-01-24" beta header, requires a handler, and
|
|
1397
|
+
* supports `view`, `create`, `str_replace`, `insert`, and `undo_edit` commands.
|
|
886
1398
|
*
|
|
887
|
-
* @
|
|
1399
|
+
* @see {@link TextEditor_20241022} for the older `str_replace_editor` version
|
|
1400
|
+
* @see {@link TextEditor_20250429} for the Claude 4 `str_replace_based_edit_tool` line
|
|
1401
|
+
*
|
|
1402
|
+
* @category text editor
|
|
888
1403
|
* @since 4.0.0
|
|
889
1404
|
*/
|
|
890
1405
|
export const TextEditor_20250124 = /*#__PURE__*/Tool.providerDefined({
|
|
@@ -896,7 +1411,12 @@ export const TextEditor_20250124 = /*#__PURE__*/Tool.providerDefined({
|
|
|
896
1411
|
success: Schema.String
|
|
897
1412
|
});
|
|
898
1413
|
/**
|
|
899
|
-
*
|
|
1414
|
+
* Defines the text editor tool for Claude 4 models using Anthropic's `str_replace_based_edit_tool`.
|
|
1415
|
+
*
|
|
1416
|
+
* **When to use**
|
|
1417
|
+
*
|
|
1418
|
+
* Use when configuring the 2025-04-29 Claude 4 `str_replace_based_edit_tool`
|
|
1419
|
+
* version.
|
|
900
1420
|
*
|
|
901
1421
|
* **Details**
|
|
902
1422
|
*
|
|
@@ -906,7 +1426,10 @@ export const TextEditor_20250124 = /*#__PURE__*/Tool.providerDefined({
|
|
|
906
1426
|
*
|
|
907
1427
|
* This version does not support the `undo_edit` command.
|
|
908
1428
|
*
|
|
909
|
-
* @
|
|
1429
|
+
* @see {@link TextEditor_20250124} for the previous `str_replace_editor` version
|
|
1430
|
+
* @see {@link TextEditor_20250728} for the later Claude 4 text editor version
|
|
1431
|
+
*
|
|
1432
|
+
* @category text editor
|
|
910
1433
|
* @since 4.0.0
|
|
911
1434
|
*/
|
|
912
1435
|
export const TextEditor_20250429 = /*#__PURE__*/Tool.providerDefined({
|
|
@@ -919,13 +1442,18 @@ export const TextEditor_20250429 = /*#__PURE__*/Tool.providerDefined({
|
|
|
919
1442
|
success: Schema.String
|
|
920
1443
|
});
|
|
921
1444
|
/**
|
|
922
|
-
*
|
|
1445
|
+
* Defines the text editor tool for Claude 4 models.
|
|
1446
|
+
*
|
|
1447
|
+
* **Details**
|
|
1448
|
+
*
|
|
1449
|
+
* Uses Anthropic's `str_replace_based_edit_tool`. `max_characters` can limit
|
|
1450
|
+
* file-view output for this version.
|
|
923
1451
|
*
|
|
924
1452
|
* **Gotchas**
|
|
925
1453
|
*
|
|
926
1454
|
* This version does not support the `undo_edit` command.
|
|
927
1455
|
*
|
|
928
|
-
* @category
|
|
1456
|
+
* @category text editor
|
|
929
1457
|
* @since 4.0.0
|
|
930
1458
|
*/
|
|
931
1459
|
export const TextEditor_20250728 = /*#__PURE__*/Tool.providerDefined({
|
|
@@ -944,12 +1472,20 @@ export const TextEditor_20250728 = /*#__PURE__*/Tool.providerDefined({
|
|
|
944
1472
|
// Web Search Types
|
|
945
1473
|
// -----------------------------------------------------------------------------
|
|
946
1474
|
/**
|
|
947
|
-
*
|
|
1475
|
+
* Describes user location for localizing search results.
|
|
948
1476
|
*
|
|
949
1477
|
* **When to use**
|
|
950
1478
|
*
|
|
951
|
-
*
|
|
952
|
-
* queries like weather, local businesses, events
|
|
1479
|
+
* Use when providing location helps return more relevant results for
|
|
1480
|
+
* location-dependent queries like weather, local businesses, or events.
|
|
1481
|
+
*
|
|
1482
|
+
* **Details**
|
|
1483
|
+
*
|
|
1484
|
+
* The schema uses `type: "approximate"` plus optional `city`, `region`,
|
|
1485
|
+
* `country`, and `timezone`. `country` is an ISO 3166-1 alpha-2 code, and
|
|
1486
|
+
* `timezone` is an IANA time zone identifier.
|
|
1487
|
+
*
|
|
1488
|
+
* @see {@link WebSearch_20250305_Args} for the argument schema that consumes this location
|
|
953
1489
|
*
|
|
954
1490
|
* @category Web Search
|
|
955
1491
|
* @since 4.0.0
|
|
@@ -980,7 +1516,24 @@ export const WebSearchUserLocation = /*#__PURE__*/Schema.Struct({
|
|
|
980
1516
|
// Web Search Args
|
|
981
1517
|
// -----------------------------------------------------------------------------
|
|
982
1518
|
/**
|
|
983
|
-
*
|
|
1519
|
+
* Defines configuration arguments for the web search tool.
|
|
1520
|
+
*
|
|
1521
|
+
* **When to use**
|
|
1522
|
+
*
|
|
1523
|
+
* Use when configuring `WebSearch_20250305` with search limits, domain filters,
|
|
1524
|
+
* or user location.
|
|
1525
|
+
*
|
|
1526
|
+
* **Details**
|
|
1527
|
+
*
|
|
1528
|
+
* The payload can set `maxUses`, `allowedDomains`, `blockedDomains`, and
|
|
1529
|
+
* `userLocation`.
|
|
1530
|
+
*
|
|
1531
|
+
* **Gotchas**
|
|
1532
|
+
*
|
|
1533
|
+
* `allowedDomains` and `blockedDomains` are mutually exclusive.
|
|
1534
|
+
*
|
|
1535
|
+
* @see {@link WebSearch_20250305} for the provider-defined tool that consumes these arguments
|
|
1536
|
+
* @see {@link WebSearchUserLocation} for localizing search results
|
|
984
1537
|
*
|
|
985
1538
|
* @category Web Search
|
|
986
1539
|
* @since 4.0.0
|
|
@@ -1011,7 +1564,14 @@ export const WebSearch_20250305_Args = /*#__PURE__*/Schema.Struct({
|
|
|
1011
1564
|
// Web Search Parameters
|
|
1012
1565
|
// -----------------------------------------------------------------------------
|
|
1013
1566
|
/**
|
|
1014
|
-
*
|
|
1567
|
+
* Schema for Claude-supplied web search tool parameters.
|
|
1568
|
+
*
|
|
1569
|
+
* **Details**
|
|
1570
|
+
*
|
|
1571
|
+
* The payload contains the generated `query` string and is consumed by
|
|
1572
|
+
* `WebSearch_20250305`.
|
|
1573
|
+
*
|
|
1574
|
+
* @see {@link WebSearch_20250305} for the provider-defined tool that consumes this payload
|
|
1015
1575
|
*
|
|
1016
1576
|
* @category Web Search
|
|
1017
1577
|
* @since 4.0.0
|
|
@@ -1026,7 +1586,11 @@ export const WebSearchParameters = /*#__PURE__*/Schema.Struct({
|
|
|
1026
1586
|
// Web Search Tool Definitions
|
|
1027
1587
|
// -----------------------------------------------------------------------------
|
|
1028
1588
|
/**
|
|
1029
|
-
*
|
|
1589
|
+
* Defines the web search tool for Claude models.
|
|
1590
|
+
*
|
|
1591
|
+
* **When to use**
|
|
1592
|
+
*
|
|
1593
|
+
* Use when Claude should search the web for real-time information.
|
|
1030
1594
|
*
|
|
1031
1595
|
* **Details**
|
|
1032
1596
|
*
|
|
@@ -1034,6 +1598,8 @@ export const WebSearchParameters = /*#__PURE__*/Schema.Struct({
|
|
|
1034
1598
|
* server-side tool executed by Anthropic's infrastructure.
|
|
1035
1599
|
* Generally available (no beta header required).
|
|
1036
1600
|
*
|
|
1601
|
+
* @see {@link WebFetch_20250910} for retrieving known URLs after discovery
|
|
1602
|
+
*
|
|
1037
1603
|
* @category Web Search
|
|
1038
1604
|
* @since 4.0.0
|
|
1039
1605
|
*/
|
|
@@ -1053,7 +1619,18 @@ export const WebSearch_20250305 = /*#__PURE__*/Tool.providerDefined({
|
|
|
1053
1619
|
// Web Fetch Types
|
|
1054
1620
|
// -----------------------------------------------------------------------------
|
|
1055
1621
|
/**
|
|
1056
|
-
*
|
|
1622
|
+
* Defines citation configuration for web fetch.
|
|
1623
|
+
*
|
|
1624
|
+
* **When to use**
|
|
1625
|
+
*
|
|
1626
|
+
* Use when configuring whether web fetch results should include citations.
|
|
1627
|
+
*
|
|
1628
|
+
* **Details**
|
|
1629
|
+
*
|
|
1630
|
+
* The payload contains the `enabled` flag. `citations` is optional on
|
|
1631
|
+
* `WebFetch_20250910_Args`, and citations are disabled by default.
|
|
1632
|
+
*
|
|
1633
|
+
* @see {@link WebFetch_20250910_Args} for the argument schema that consumes this configuration
|
|
1057
1634
|
*
|
|
1058
1635
|
* @category Web Fetch
|
|
1059
1636
|
* @since 4.0.0
|
|
@@ -1068,7 +1645,26 @@ export const WebFetchCitationsConfig = /*#__PURE__*/Schema.Struct({
|
|
|
1068
1645
|
// Web Fetch Args
|
|
1069
1646
|
// -----------------------------------------------------------------------------
|
|
1070
1647
|
/**
|
|
1071
|
-
*
|
|
1648
|
+
* Defines configuration arguments for the web fetch tool.
|
|
1649
|
+
*
|
|
1650
|
+
* **When to use**
|
|
1651
|
+
*
|
|
1652
|
+
* Use when configuring `WebFetch_20250910` with usage limits, domain filters,
|
|
1653
|
+
* citations, or content token limits.
|
|
1654
|
+
*
|
|
1655
|
+
* **Details**
|
|
1656
|
+
*
|
|
1657
|
+
* The payload can set `maxUses`, domain filters, `citations`, and
|
|
1658
|
+
* `maxContentTokens`, which map to Anthropic web fetch request fields.
|
|
1659
|
+
*
|
|
1660
|
+
* **Gotchas**
|
|
1661
|
+
*
|
|
1662
|
+
* `allowedDomains` and `blockedDomains` are mutually exclusive.
|
|
1663
|
+
* `maxContentTokens` is approximate and does not apply to binary content such
|
|
1664
|
+
* as PDFs.
|
|
1665
|
+
*
|
|
1666
|
+
* @see {@link WebFetch_20250910} for the provider-defined tool that consumes these arguments
|
|
1667
|
+
* @see {@link WebFetchCitationsConfig} for configuring citations
|
|
1072
1668
|
*
|
|
1073
1669
|
* @category Web Fetch
|
|
1074
1670
|
* @since 4.0.0
|
|
@@ -1103,7 +1699,23 @@ export const WebFetch_20250910_Args = /*#__PURE__*/Schema.Struct({
|
|
|
1103
1699
|
// Web Fetch Parameters
|
|
1104
1700
|
// -----------------------------------------------------------------------------
|
|
1105
1701
|
/**
|
|
1106
|
-
*
|
|
1702
|
+
* Schema for Claude-supplied web fetch parameters.
|
|
1703
|
+
*
|
|
1704
|
+
* **When to use**
|
|
1705
|
+
*
|
|
1706
|
+
* Use when validating or constructing the `url` payload consumed by
|
|
1707
|
+
* `WebFetch_20250910`.
|
|
1708
|
+
*
|
|
1709
|
+
* **Details**
|
|
1710
|
+
*
|
|
1711
|
+
* The payload contains the single `url` parameter for Anthropic web fetch.
|
|
1712
|
+
*
|
|
1713
|
+
* **Gotchas**
|
|
1714
|
+
*
|
|
1715
|
+
* The URL must be user-provided or from prior search/fetch results. Maximum URL
|
|
1716
|
+
* length is 250 characters.
|
|
1717
|
+
*
|
|
1718
|
+
* @see {@link WebFetch_20250910} for the provider-defined tool that consumes this payload
|
|
1107
1719
|
*
|
|
1108
1720
|
* @category Web Fetch
|
|
1109
1721
|
* @since 4.0.0
|
|
@@ -1119,13 +1731,19 @@ export const WebFetchParameters = /*#__PURE__*/Schema.Struct({
|
|
|
1119
1731
|
// Web Fetch Tool Definitions
|
|
1120
1732
|
// -----------------------------------------------------------------------------
|
|
1121
1733
|
/**
|
|
1122
|
-
*
|
|
1734
|
+
* Defines the web fetch tool for Claude models.
|
|
1735
|
+
*
|
|
1736
|
+
* **When to use**
|
|
1737
|
+
*
|
|
1738
|
+
* Use when Claude should retrieve the content of a specific web page or PDF.
|
|
1123
1739
|
*
|
|
1124
1740
|
* **Details**
|
|
1125
1741
|
*
|
|
1126
1742
|
* 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
|
-
*
|
|
1743
|
+
* This is a server-side tool executed by Anthropic's infrastructure. Selecting
|
|
1744
|
+
* this tool adds the "web-fetch-2025-09-10" beta header.
|
|
1745
|
+
*
|
|
1746
|
+
* @see {@link WebSearch_20250305} for discovering URLs before fetching specific content
|
|
1129
1747
|
*
|
|
1130
1748
|
* @category Web Fetch
|
|
1131
1749
|
* @since 4.0.0
|
|
@@ -1146,14 +1764,14 @@ export const WebFetch_20250910 = /*#__PURE__*/Tool.providerDefined({
|
|
|
1146
1764
|
// Tool Search Parameters
|
|
1147
1765
|
// -----------------------------------------------------------------------------
|
|
1148
1766
|
/**
|
|
1149
|
-
*
|
|
1767
|
+
* Schema for regex-based tool search input parameters.
|
|
1150
1768
|
*
|
|
1151
1769
|
* **Details**
|
|
1152
1770
|
*
|
|
1153
1771
|
* Claude constructs regex patterns using Python's `re.search()` syntax.
|
|
1154
1772
|
* Maximum query length: 200 characters.
|
|
1155
1773
|
*
|
|
1156
|
-
* @category
|
|
1774
|
+
* @category tool search
|
|
1157
1775
|
* @since 4.0.0
|
|
1158
1776
|
*/
|
|
1159
1777
|
export const ToolSearchRegexParameters = /*#__PURE__*/Schema.Struct({
|
|
@@ -1163,9 +1781,21 @@ export const ToolSearchRegexParameters = /*#__PURE__*/Schema.Struct({
|
|
|
1163
1781
|
query: Schema.String
|
|
1164
1782
|
});
|
|
1165
1783
|
/**
|
|
1166
|
-
*
|
|
1784
|
+
* Defines input parameters for BM25/natural language tool search.
|
|
1785
|
+
*
|
|
1786
|
+
* **When to use**
|
|
1787
|
+
*
|
|
1788
|
+
* Use when validating or constructing the natural-language query payload for
|
|
1789
|
+
* `ToolSearchBM25_20251119`.
|
|
1790
|
+
*
|
|
1791
|
+
* **Details**
|
|
1792
|
+
*
|
|
1793
|
+
* The payload contains Claude's natural-language `query`. BM25 searches tool
|
|
1794
|
+
* names, descriptions, argument names, and argument descriptions.
|
|
1167
1795
|
*
|
|
1168
|
-
* @
|
|
1796
|
+
* @see {@link ToolSearchBM25_20251119} for the provider-defined tool that consumes these parameters
|
|
1797
|
+
*
|
|
1798
|
+
* @category tool search
|
|
1169
1799
|
* @since 4.0.0
|
|
1170
1800
|
*/
|
|
1171
1801
|
export const ToolSearchBM25Parameters = /*#__PURE__*/Schema.Struct({
|
|
@@ -1178,7 +1808,7 @@ export const ToolSearchBM25Parameters = /*#__PURE__*/Schema.Struct({
|
|
|
1178
1808
|
// Tool Search Tool Definitions
|
|
1179
1809
|
// -----------------------------------------------------------------------------
|
|
1180
1810
|
/**
|
|
1181
|
-
*
|
|
1811
|
+
* Defines regex-based tool search for Claude models.
|
|
1182
1812
|
*
|
|
1183
1813
|
* **Details**
|
|
1184
1814
|
*
|
|
@@ -1187,7 +1817,7 @@ export const ToolSearchBM25Parameters = /*#__PURE__*/Schema.Struct({
|
|
|
1187
1817
|
* argument names, and argument descriptions.
|
|
1188
1818
|
* Requires the "advanced-tool-use-2025-11-20" beta header.
|
|
1189
1819
|
*
|
|
1190
|
-
* @category
|
|
1820
|
+
* @category tool search
|
|
1191
1821
|
* @since 4.0.0
|
|
1192
1822
|
*/
|
|
1193
1823
|
export const ToolSearchRegex_20251119 = /*#__PURE__*/Tool.providerDefined({
|
|
@@ -1199,7 +1829,12 @@ export const ToolSearchRegex_20251119 = /*#__PURE__*/Tool.providerDefined({
|
|
|
1199
1829
|
failure: Generated.BetaResponseToolSearchToolResultError
|
|
1200
1830
|
});
|
|
1201
1831
|
/**
|
|
1202
|
-
* BM25/natural language tool search for Claude models.
|
|
1832
|
+
* Defines BM25/natural language tool search for Claude models.
|
|
1833
|
+
*
|
|
1834
|
+
* **When to use**
|
|
1835
|
+
*
|
|
1836
|
+
* Use when you want Claude to find relevant tools from a natural-language query
|
|
1837
|
+
* instead of a regex pattern.
|
|
1203
1838
|
*
|
|
1204
1839
|
* **Details**
|
|
1205
1840
|
*
|
|
@@ -1208,7 +1843,9 @@ export const ToolSearchRegex_20251119 = /*#__PURE__*/Tool.providerDefined({
|
|
|
1208
1843
|
* argument names, and argument descriptions.
|
|
1209
1844
|
* Requires the "advanced-tool-use-2025-11-20" beta header.
|
|
1210
1845
|
*
|
|
1211
|
-
* @
|
|
1846
|
+
* @see {@link ToolSearchRegex_20251119} for the regex-pattern alternative
|
|
1847
|
+
*
|
|
1848
|
+
* @category tool search
|
|
1212
1849
|
* @since 4.0.0
|
|
1213
1850
|
*/
|
|
1214
1851
|
export const ToolSearchBM25_20251119 = /*#__PURE__*/Tool.providerDefined({
|