@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/src/AnthropicTool.ts
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
|
*/
|
|
@@ -11,7 +61,18 @@ import * as Tool from "effect/unstable/ai/Tool"
|
|
|
11
61
|
import * as Generated from "./Generated.ts"
|
|
12
62
|
|
|
13
63
|
/**
|
|
14
|
-
* Union of all Anthropic provider-defined
|
|
64
|
+
* Union of all Anthropic provider-defined tool definitions exported by this module.
|
|
65
|
+
*
|
|
66
|
+
* **When to use**
|
|
67
|
+
*
|
|
68
|
+
* Use when a helper, collection, or option accepts any Anthropic
|
|
69
|
+
* provider-defined tool value created by this module.
|
|
70
|
+
*
|
|
71
|
+
* **Details**
|
|
72
|
+
*
|
|
73
|
+
* The union is built from the return types of the exported constructors,
|
|
74
|
+
* including Bash, Code Execution, Computer Use, Memory, Text Editor, Tool
|
|
75
|
+
* Search, Web Fetch, and Web Search tool versions.
|
|
15
76
|
*
|
|
16
77
|
* @category models
|
|
17
78
|
* @since 4.0.0
|
|
@@ -39,13 +100,20 @@ export type AnthropicTool =
|
|
|
39
100
|
// =============================================================================
|
|
40
101
|
|
|
41
102
|
/**
|
|
42
|
-
* Anthropic Bash tool (2024-10-22 version).
|
|
103
|
+
* Defines the Anthropic Bash tool (2024-10-22 version).
|
|
104
|
+
*
|
|
105
|
+
* **When to use**
|
|
106
|
+
*
|
|
107
|
+
* Use when you need the model to execute bash commands and require the 2024-10-22
|
|
108
|
+
* version of the Anthropic computer-use beta.
|
|
43
109
|
*
|
|
44
110
|
* **Details**
|
|
45
111
|
*
|
|
46
112
|
* Allows the model to execute bash commands in a sandboxed environment.
|
|
47
113
|
* Requires the "computer-use-2024-10-22" beta header.
|
|
48
114
|
*
|
|
115
|
+
* @see {@link Bash_20250124} for the newer 2025-01-24 version of the bash tool
|
|
116
|
+
*
|
|
49
117
|
* @category Bash
|
|
50
118
|
* @since 4.0.0
|
|
51
119
|
*/
|
|
@@ -62,13 +130,20 @@ export const Bash_20241022 = Tool.providerDefined({
|
|
|
62
130
|
})
|
|
63
131
|
|
|
64
132
|
/**
|
|
65
|
-
* Anthropic Bash tool (2025-01-24 version).
|
|
133
|
+
* Defines the Anthropic Bash tool (2025-01-24 version).
|
|
134
|
+
*
|
|
135
|
+
* **When to use**
|
|
136
|
+
*
|
|
137
|
+
* Use when you need the model to execute bash commands and require the 2025-01-24
|
|
138
|
+
* version of the Anthropic computer-use beta.
|
|
66
139
|
*
|
|
67
140
|
* **Details**
|
|
68
141
|
*
|
|
69
142
|
* Allows the model to execute bash commands in a sandboxed environment.
|
|
70
143
|
* Requires the "computer-use-2025-01-24" beta header.
|
|
71
144
|
*
|
|
145
|
+
* @see {@link Bash_20241022} for the older 2024-10-22 version of the bash tool
|
|
146
|
+
*
|
|
72
147
|
* @category Bash
|
|
73
148
|
* @since 4.0.0
|
|
74
149
|
*/
|
|
@@ -95,6 +170,13 @@ export const Bash_20250124 = Tool.providerDefined({
|
|
|
95
170
|
/**
|
|
96
171
|
* Schema for a code execution request that asks Anthropic to run source code as a programmatic tool call.
|
|
97
172
|
*
|
|
173
|
+
* **When to use**
|
|
174
|
+
*
|
|
175
|
+
* Use when constructing or validating a programmatic tool call for the Anthropic
|
|
176
|
+
* Code Execution tool.
|
|
177
|
+
*
|
|
178
|
+
* @see {@link CodeExecution_20250522} for the parent tool definition
|
|
179
|
+
*
|
|
98
180
|
* @category Code Execution
|
|
99
181
|
* @since 4.0.0
|
|
100
182
|
*/
|
|
@@ -114,7 +196,19 @@ export const CodeExecutionProgrammaticToolCall = Schema.Struct({
|
|
|
114
196
|
export type CodeExecutionProgrammaticToolCall = typeof CodeExecutionProgrammaticToolCall.Type
|
|
115
197
|
|
|
116
198
|
/**
|
|
117
|
-
* Schema for
|
|
199
|
+
* Schema for the `bash_code_execution` input variant of Anthropic Code Execution.
|
|
200
|
+
*
|
|
201
|
+
* **When to use**
|
|
202
|
+
*
|
|
203
|
+
* Use when validating or constructing a bash command request for
|
|
204
|
+
* `CodeExecution_20250522`.
|
|
205
|
+
*
|
|
206
|
+
* **Details**
|
|
207
|
+
*
|
|
208
|
+
* The schema requires `type` to be `"bash_code_execution"` and `command` to
|
|
209
|
+
* contain the bash command sent to Anthropic.
|
|
210
|
+
*
|
|
211
|
+
* @see {@link CodeExecution_20250522} for the provider-defined tool that consumes this input variant
|
|
118
212
|
*
|
|
119
213
|
* @category Code Execution
|
|
120
214
|
* @since 4.0.0
|
|
@@ -127,7 +221,24 @@ export const CodeExecutionBashCommand = Schema.Struct({
|
|
|
127
221
|
command: Schema.String
|
|
128
222
|
})
|
|
129
223
|
/**
|
|
130
|
-
* Input payload for a bash command
|
|
224
|
+
* Input payload for a bash command routed through the Anthropic code execution tool.
|
|
225
|
+
*
|
|
226
|
+
* **When to use**
|
|
227
|
+
*
|
|
228
|
+
* Use when representing a provider-executed bash command request for the
|
|
229
|
+
* 2025-05-22 code execution tool.
|
|
230
|
+
*
|
|
231
|
+
* **Details**
|
|
232
|
+
*
|
|
233
|
+
* The payload uses `type: "bash_code_execution"` to distinguish bash execution
|
|
234
|
+
* from programmatic code and text editor operations, and `command` contains the
|
|
235
|
+
* bash command to run.
|
|
236
|
+
*
|
|
237
|
+
* @see {@link CodeExecutionProgrammaticToolCall} for programmatic code execution input
|
|
238
|
+
* @see {@link CodeExecutionTextEditorView} for viewing files through text editor code execution
|
|
239
|
+
* @see {@link CodeExecutionTextEditorCreate} for creating files through text editor code execution
|
|
240
|
+
* @see {@link CodeExecutionTextEditorStrReplace} for replacing text through text editor code execution
|
|
241
|
+
* @see {@link CodeExecution_20250522} for the provider-defined tool that consumes this payload
|
|
131
242
|
*
|
|
132
243
|
* @category Code Execution
|
|
133
244
|
* @since 4.0.0
|
|
@@ -135,7 +246,20 @@ export const CodeExecutionBashCommand = Schema.Struct({
|
|
|
135
246
|
export type CodeExecutionBashCommand = typeof CodeExecutionBashCommand.Type
|
|
136
247
|
|
|
137
248
|
/**
|
|
138
|
-
*
|
|
249
|
+
* Schema for a code execution text editor request that views a file by path.
|
|
250
|
+
*
|
|
251
|
+
* **When to use**
|
|
252
|
+
*
|
|
253
|
+
* Use to validate or construct the `view` command for Anthropic code execution
|
|
254
|
+
* text editor tool calls.
|
|
255
|
+
*
|
|
256
|
+
* **Details**
|
|
257
|
+
*
|
|
258
|
+
* The encoded payload uses `type: "text_editor_code_execution"`,
|
|
259
|
+
* `command: "view"`, and a `path` string.
|
|
260
|
+
*
|
|
261
|
+
* @see {@link CodeExecutionTextEditorCreate} for the command that creates a file
|
|
262
|
+
* @see {@link CodeExecutionTextEditorStrReplace} for the command that replaces text in a file
|
|
139
263
|
*
|
|
140
264
|
* @category Code Execution
|
|
141
265
|
* @since 4.0.0
|
|
@@ -149,7 +273,26 @@ export const CodeExecutionTextEditorView = Schema.Struct({
|
|
|
149
273
|
path: Schema.String
|
|
150
274
|
})
|
|
151
275
|
/**
|
|
152
|
-
* Input payload for
|
|
276
|
+
* Input payload for the `view` command of Anthropic's text editor code execution tool.
|
|
277
|
+
*
|
|
278
|
+
* **When to use**
|
|
279
|
+
*
|
|
280
|
+
* Use when handling or validating the `view` command for Anthropic's text
|
|
281
|
+
* editor code execution tool.
|
|
282
|
+
*
|
|
283
|
+
* **Details**
|
|
284
|
+
*
|
|
285
|
+
* The payload is discriminated by `type: "text_editor_code_execution"` and
|
|
286
|
+
* `command: "view"`. The `path` field identifies the file to view.
|
|
287
|
+
*
|
|
288
|
+
* **Gotchas**
|
|
289
|
+
*
|
|
290
|
+
* This code execution view payload does not include `view_range`; line ranges
|
|
291
|
+
* are part of the standalone text editor view payload, not this code execution
|
|
292
|
+
* payload.
|
|
293
|
+
*
|
|
294
|
+
* @see {@link CodeExecution_20250522} for the provider-defined code execution tool that includes this payload
|
|
295
|
+
* @see {@link TextEditorViewCommand} for the standalone text editor view payload
|
|
153
296
|
*
|
|
154
297
|
* @category Code Execution
|
|
155
298
|
* @since 4.0.0
|
|
@@ -157,7 +300,22 @@ export const CodeExecutionTextEditorView = Schema.Struct({
|
|
|
157
300
|
export type CodeExecutionTextEditorView = typeof CodeExecutionTextEditorView.Type
|
|
158
301
|
|
|
159
302
|
/**
|
|
160
|
-
*
|
|
303
|
+
* Schema for a text editor code execution request that creates a file at a path.
|
|
304
|
+
*
|
|
305
|
+
* **When to use**
|
|
306
|
+
*
|
|
307
|
+
* Use when validating or constructing an Anthropic `text_editor_code_execution`
|
|
308
|
+
* tool call that should create a file.
|
|
309
|
+
*
|
|
310
|
+
* **Details**
|
|
311
|
+
*
|
|
312
|
+
* The request is discriminated by `type: "text_editor_code_execution"` and
|
|
313
|
+
* `command: "create"`. It requires `path` and accepts optional `file_text`; the
|
|
314
|
+
* schema allows `file_text` to be omitted, `null`, or a string.
|
|
315
|
+
*
|
|
316
|
+
* @see {@link CodeExecution_20250522} for the provider-defined tool that consumes this request
|
|
317
|
+
* @see {@link CodeExecutionTextEditorView} for the matching view request
|
|
318
|
+
* @see {@link CodeExecutionTextEditorStrReplace} for the matching replace request
|
|
161
319
|
*
|
|
162
320
|
* @category Code Execution
|
|
163
321
|
* @since 4.0.0
|
|
@@ -183,7 +341,20 @@ export const CodeExecutionTextEditorCreate = Schema.Struct({
|
|
|
183
341
|
export type CodeExecutionTextEditorCreate = typeof CodeExecutionTextEditorCreate.Type
|
|
184
342
|
|
|
185
343
|
/**
|
|
186
|
-
*
|
|
344
|
+
* Schema for a code execution text editor request that replaces one exact string in a file.
|
|
345
|
+
*
|
|
346
|
+
* **When to use**
|
|
347
|
+
*
|
|
348
|
+
* Use when validating or constructing the `str_replace` text editor operation
|
|
349
|
+
* for the 2025-05-22 Anthropic code execution tool.
|
|
350
|
+
*
|
|
351
|
+
* **Gotchas**
|
|
352
|
+
*
|
|
353
|
+
* The `old_str` must match the file contents exactly, including whitespace and
|
|
354
|
+
* indentation, and must identify a single occurrence.
|
|
355
|
+
*
|
|
356
|
+
* @see {@link CodeExecutionTextEditorView} for reading file contents before choosing the replacement text
|
|
357
|
+
* @see {@link CodeExecution_20250522} for the provider-defined tool that consumes this payload
|
|
187
358
|
*
|
|
188
359
|
* @category Code Execution
|
|
189
360
|
* @since 4.0.0
|
|
@@ -227,6 +398,13 @@ const CodeExecution_20250522_Parameters = Schema.Union([
|
|
|
227
398
|
/**
|
|
228
399
|
* Schema for the 2025-08-25 code execution tool input, containing the code to execute.
|
|
229
400
|
*
|
|
401
|
+
* **When to use**
|
|
402
|
+
*
|
|
403
|
+
* Use when validating or constructing the input payload for the 2025-08-25
|
|
404
|
+
* Anthropic code execution tool.
|
|
405
|
+
*
|
|
406
|
+
* @see {@link CodeExecution_20250825} for the provider-defined tool that consumes this schema
|
|
407
|
+
*
|
|
230
408
|
* @category Code Execution
|
|
231
409
|
* @since 4.0.0
|
|
232
410
|
*/
|
|
@@ -239,6 +417,17 @@ export const CodeExecution_20250825_Parameters = Schema.Struct({
|
|
|
239
417
|
/**
|
|
240
418
|
* Input payload for the 2025-08-25 Anthropic code execution tool.
|
|
241
419
|
*
|
|
420
|
+
* **When to use**
|
|
421
|
+
*
|
|
422
|
+
* Use when typing input passed to the 2025-08-25 Anthropic code execution tool.
|
|
423
|
+
*
|
|
424
|
+
* **Details**
|
|
425
|
+
*
|
|
426
|
+
* The payload has a single `code` field containing the source code string to
|
|
427
|
+
* execute.
|
|
428
|
+
*
|
|
429
|
+
* @see {@link CodeExecution_20250825} for the provider-defined tool that consumes this payload
|
|
430
|
+
*
|
|
242
431
|
* @category Code Execution
|
|
243
432
|
* @since 4.0.0
|
|
244
433
|
*/
|
|
@@ -249,7 +438,12 @@ export type CodeExecution_20250825_Parameters = typeof CodeExecution_20250825_Pa
|
|
|
249
438
|
// -----------------------------------------------------------------------------
|
|
250
439
|
|
|
251
440
|
/**
|
|
252
|
-
* Anthropic Code Execution tool (2025-05-22 version).
|
|
441
|
+
* Defines the Anthropic Code Execution tool (2025-05-22 version).
|
|
442
|
+
*
|
|
443
|
+
* **When to use**
|
|
444
|
+
*
|
|
445
|
+
* Use when you need the model to execute code in a sandboxed environment and
|
|
446
|
+
* require the 2025-05-22 version of the Anthropic code-execution beta.
|
|
253
447
|
*
|
|
254
448
|
* **Details**
|
|
255
449
|
*
|
|
@@ -257,6 +451,8 @@ export type CodeExecution_20250825_Parameters = typeof CodeExecution_20250825_Pa
|
|
|
257
451
|
* for multiple execution types including programmatic tool calls, bash
|
|
258
452
|
* execution, and text editor operations.
|
|
259
453
|
*
|
|
454
|
+
* @see {@link CodeExecutionProgrammaticToolCall} for the programmatic tool call schema
|
|
455
|
+
*
|
|
260
456
|
* @category Code Execution
|
|
261
457
|
* @since 4.0.0
|
|
262
458
|
*/
|
|
@@ -270,11 +466,20 @@ export const CodeExecution_20250522 = Tool.providerDefined({
|
|
|
270
466
|
})
|
|
271
467
|
|
|
272
468
|
/**
|
|
273
|
-
* Anthropic Code Execution tool (2025-08-25 version).
|
|
469
|
+
* Defines the Anthropic Code Execution tool (2025-08-25 version).
|
|
470
|
+
*
|
|
471
|
+
* **When to use**
|
|
472
|
+
*
|
|
473
|
+
* Use when you need the model to execute code in a sandboxed environment and
|
|
474
|
+
* require the 2025-08-25 version of the Anthropic code-execution beta.
|
|
274
475
|
*
|
|
275
476
|
* **Details**
|
|
276
477
|
*
|
|
277
|
-
*
|
|
478
|
+
* Requires the `code-execution-2025-08-25` beta header and uses
|
|
479
|
+
* `CodeExecution_20250825_Parameters` as its input schema.
|
|
480
|
+
*
|
|
481
|
+
* @see {@link CodeExecution_20250522} for the older 2025-05-22 code execution tool
|
|
482
|
+
* @see {@link CodeExecution_20250825_Parameters} for the input schema consumed by this tool
|
|
278
483
|
*
|
|
279
484
|
* @category Code Execution
|
|
280
485
|
* @since 4.0.0
|
|
@@ -307,61 +512,89 @@ export const CodeExecution_20250825 = Tool.providerDefined({
|
|
|
307
512
|
// -----------------------------------------------------------------------------
|
|
308
513
|
|
|
309
514
|
/**
|
|
310
|
-
*
|
|
515
|
+
* Schema for an `[x, y]` screen coordinate in pixels.
|
|
516
|
+
*
|
|
517
|
+
* **Details**
|
|
518
|
+
*
|
|
519
|
+
* This is a two-number tuple used by computer-use actions that accept screen
|
|
520
|
+
* positions.
|
|
521
|
+
*
|
|
522
|
+
* **Gotchas**
|
|
523
|
+
*
|
|
524
|
+
* This schema validates tuple shape only and does not check display bounds.
|
|
311
525
|
*
|
|
312
|
-
* @category
|
|
526
|
+
* @category computer use
|
|
313
527
|
* @since 4.0.0
|
|
314
528
|
*/
|
|
315
529
|
export const Coordinate = Schema.Tuple([Schema.Number, Schema.Number])
|
|
316
530
|
/**
|
|
317
531
|
* An `[x, y]` screen coordinate in pixels.
|
|
318
532
|
*
|
|
319
|
-
* @category
|
|
533
|
+
* @category computer use
|
|
320
534
|
* @since 4.0.0
|
|
321
535
|
*/
|
|
322
536
|
export type Coordinate = typeof Coordinate.Type
|
|
323
537
|
|
|
324
538
|
/**
|
|
325
|
-
*
|
|
539
|
+
* Schema for an `[x1, y1, x2, y2]` screen region in pixels.
|
|
326
540
|
*
|
|
327
|
-
*
|
|
541
|
+
* **Details**
|
|
542
|
+
*
|
|
543
|
+
* The tuple represents top-left and bottom-right corners.
|
|
544
|
+
*
|
|
545
|
+
* **Gotchas**
|
|
546
|
+
*
|
|
547
|
+
* This schema validates four numbers only and does not check coordinate ordering
|
|
548
|
+
* or display bounds.
|
|
549
|
+
*
|
|
550
|
+
* @category computer use
|
|
328
551
|
* @since 4.0.0
|
|
329
552
|
*/
|
|
330
553
|
export const Region = Schema.Tuple([Schema.Number, Schema.Number, Schema.Number, Schema.Number])
|
|
331
554
|
/**
|
|
332
555
|
* An `[x1, y1, x2, y2]` screen region in pixels, from top-left to bottom-right.
|
|
333
556
|
*
|
|
334
|
-
* @category
|
|
557
|
+
* @category computer use
|
|
335
558
|
* @since 4.0.0
|
|
336
559
|
*/
|
|
337
560
|
export type Region = typeof Region.Type
|
|
338
561
|
|
|
339
562
|
/**
|
|
340
|
-
*
|
|
563
|
+
* Schema for scroll direction literals: `"up"`, `"down"`, `"left"`, or `"right"`.
|
|
341
564
|
*
|
|
342
|
-
* @
|
|
565
|
+
* @see {@link ComputerUseScrollAction} for the action payload that consumes this schema
|
|
566
|
+
*
|
|
567
|
+
* @category computer use
|
|
343
568
|
* @since 4.0.0
|
|
344
569
|
*/
|
|
345
570
|
export const ScrollDirection = Schema.Literals(["up", "down", "left", "right"])
|
|
346
571
|
/**
|
|
347
572
|
* Direction used by computer-use scroll actions: `"up"`, `"down"`, `"left"`, or `"right"`.
|
|
348
573
|
*
|
|
349
|
-
* @category
|
|
574
|
+
* @category computer use
|
|
350
575
|
* @since 4.0.0
|
|
351
576
|
*/
|
|
352
577
|
export type ScrollDirection = typeof ScrollDirection.Type
|
|
353
578
|
|
|
354
579
|
/**
|
|
355
|
-
*
|
|
580
|
+
* Schema for modifier key literals.
|
|
581
|
+
*
|
|
582
|
+
* **Details**
|
|
356
583
|
*
|
|
357
|
-
*
|
|
584
|
+
* Allowed values are `"alt"`, `"ctrl"`, `"meta"`, and `"shift"`.
|
|
585
|
+
*
|
|
586
|
+
* @category computer use
|
|
358
587
|
* @since 4.0.0
|
|
359
588
|
*/
|
|
360
589
|
export const ModifierKey = Schema.Literals(["alt", "ctrl", "meta", "shift"])
|
|
361
590
|
/**
|
|
362
|
-
* Modifier key
|
|
591
|
+
* Modifier key literals.
|
|
592
|
+
*
|
|
593
|
+
* **Details**
|
|
363
594
|
*
|
|
364
|
-
*
|
|
595
|
+
* Allowed values are `"alt"`, `"ctrl"`, `"meta"`, and `"shift"`.
|
|
596
|
+
*
|
|
597
|
+
* @category computer use
|
|
365
598
|
* @since 4.0.0
|
|
366
599
|
*/
|
|
367
600
|
export type ModifierKey = typeof ModifierKey.Type
|
|
@@ -399,9 +632,18 @@ const ComputerUse_20251124_Args = Schema.Struct({
|
|
|
399
632
|
// -----------------------------------------------------------------------------
|
|
400
633
|
|
|
401
634
|
/**
|
|
402
|
-
*
|
|
635
|
+
* Schema for a computer-use action that presses a key or key combination, such
|
|
636
|
+
* as `"Return"`, `"ctrl+c"`, or `"ctrl+s"`.
|
|
637
|
+
*
|
|
638
|
+
* **When to use**
|
|
639
|
+
*
|
|
640
|
+
* Use when validating or constructing a computer-use action for keyboard
|
|
641
|
+
* shortcuts or non-text key presses.
|
|
403
642
|
*
|
|
404
|
-
* @
|
|
643
|
+
* @see {@link TypeAction} for entering ordinary text strings
|
|
644
|
+
* @see {@link ComputerUseHoldKeyAction} for holding a key for a duration
|
|
645
|
+
*
|
|
646
|
+
* @category computer use
|
|
405
647
|
* @since 4.0.0
|
|
406
648
|
*/
|
|
407
649
|
export const ComputerUseKeyAction = Schema.Struct({
|
|
@@ -414,15 +656,45 @@ export const ComputerUseKeyAction = Schema.Struct({
|
|
|
414
656
|
/**
|
|
415
657
|
* Computer-use action payload for pressing a key or key combination.
|
|
416
658
|
*
|
|
417
|
-
*
|
|
659
|
+
* **Details**
|
|
660
|
+
*
|
|
661
|
+
* The payload uses `action: "key"` and stores the key or key combination to
|
|
662
|
+
* press in `text`, such as `"Return"`, `"ctrl+c"`, or `"ctrl+s"`.
|
|
663
|
+
*
|
|
664
|
+
* **Gotchas**
|
|
665
|
+
*
|
|
666
|
+
* `text` is typed as `string`; the paired schema does not validate
|
|
667
|
+
* provider-specific key names or key combinations.
|
|
668
|
+
*
|
|
669
|
+
* @category computer use
|
|
418
670
|
* @since 4.0.0
|
|
419
671
|
*/
|
|
420
672
|
export type ComputerUseKeyAction = typeof ComputerUseKeyAction.Type
|
|
421
673
|
|
|
422
674
|
/**
|
|
423
|
-
*
|
|
675
|
+
* Schema for a computer-use action that performs a left click.
|
|
676
|
+
*
|
|
677
|
+
* **When to use**
|
|
424
678
|
*
|
|
425
|
-
*
|
|
679
|
+
* Use to validate or construct an Anthropic computer-use payload for clicking
|
|
680
|
+
* once at the current mouse position or at a specific screen coordinate.
|
|
681
|
+
*
|
|
682
|
+
* **Details**
|
|
683
|
+
*
|
|
684
|
+
* The encoded payload uses `action: "left_click"`. The optional `coordinate`
|
|
685
|
+
* field supplies the `[x, y]` pixel position; when omitted, the action uses the
|
|
686
|
+
* current mouse position.
|
|
687
|
+
*
|
|
688
|
+
* **Gotchas**
|
|
689
|
+
*
|
|
690
|
+
* The coordinate schema only checks that the value is a two-number tuple. It
|
|
691
|
+
* does not validate that the point falls within the configured display
|
|
692
|
+
* dimensions.
|
|
693
|
+
*
|
|
694
|
+
* @see {@link ComputerUseDoubleClickAction} for performing a double click
|
|
695
|
+
* @see {@link ComputerUseMouseMoveAction} for moving the mouse without clicking
|
|
696
|
+
*
|
|
697
|
+
* @category computer use
|
|
426
698
|
* @since 4.0.0
|
|
427
699
|
*/
|
|
428
700
|
export const ComputerUseLeftClickAction = Schema.Struct({
|
|
@@ -436,15 +708,32 @@ export const ComputerUseLeftClickAction = Schema.Struct({
|
|
|
436
708
|
/**
|
|
437
709
|
* Computer-use action payload for performing a left click, optionally at a specific coordinate.
|
|
438
710
|
*
|
|
439
|
-
* @category
|
|
711
|
+
* @category computer use
|
|
440
712
|
* @since 4.0.0
|
|
441
713
|
*/
|
|
442
714
|
export type ComputerUseLeftClickAction = typeof ComputerUseLeftClickAction.Type
|
|
443
715
|
|
|
444
716
|
/**
|
|
445
|
-
*
|
|
717
|
+
* Schema for a computer-use action that moves the mouse cursor to a required
|
|
718
|
+
* `[x, y]` screen coordinate.
|
|
719
|
+
*
|
|
720
|
+
* **When to use**
|
|
721
|
+
*
|
|
722
|
+
* Use to validate or construct a mouse movement action for an Anthropic
|
|
723
|
+
* computer-use tool call.
|
|
724
|
+
*
|
|
725
|
+
* **Details**
|
|
446
726
|
*
|
|
447
|
-
*
|
|
727
|
+
* The encoded payload has action `"mouse_move"` and a required `coordinate`
|
|
728
|
+
* field containing the target `[x, y]` pixel position.
|
|
729
|
+
*
|
|
730
|
+
* **Gotchas**
|
|
731
|
+
*
|
|
732
|
+
* The coordinate schema only checks that the value is a two-number tuple. It
|
|
733
|
+
* does not validate that the point falls within the configured display
|
|
734
|
+
* dimensions.
|
|
735
|
+
*
|
|
736
|
+
* @category computer use
|
|
448
737
|
* @since 4.0.0
|
|
449
738
|
*/
|
|
450
739
|
export const ComputerUseMouseMoveAction = Schema.Struct({
|
|
@@ -457,15 +746,27 @@ export const ComputerUseMouseMoveAction = Schema.Struct({
|
|
|
457
746
|
/**
|
|
458
747
|
* Computer-use action payload for moving the mouse cursor to a specific coordinate.
|
|
459
748
|
*
|
|
460
|
-
* @category
|
|
749
|
+
* @category computer use
|
|
461
750
|
* @since 4.0.0
|
|
462
751
|
*/
|
|
463
752
|
export type ComputerUseMouseMoveAction = typeof ComputerUseMouseMoveAction.Type
|
|
464
753
|
|
|
465
754
|
/**
|
|
466
|
-
*
|
|
755
|
+
* Schema for a computer-use action that requests a screenshot of the current display.
|
|
756
|
+
*
|
|
757
|
+
* **When to use**
|
|
758
|
+
*
|
|
759
|
+
* Use to validate or construct a computer-use tool action that asks the handler
|
|
760
|
+
* to capture the full current display.
|
|
467
761
|
*
|
|
468
|
-
*
|
|
762
|
+
* **Details**
|
|
763
|
+
*
|
|
764
|
+
* The payload contains only `action: "screenshot"` and does not include
|
|
765
|
+
* coordinates or other options.
|
|
766
|
+
*
|
|
767
|
+
* @see {@link ComputerUseZoomAction} for requesting a zoomed-in screenshot of a specific screen region with the 2025-11-24 computer-use tool
|
|
768
|
+
*
|
|
769
|
+
* @category computer use
|
|
469
770
|
* @since 4.0.0
|
|
470
771
|
*/
|
|
471
772
|
export const ComputerUseScreenshotAction = Schema.Struct({
|
|
@@ -474,15 +775,27 @@ export const ComputerUseScreenshotAction = Schema.Struct({
|
|
|
474
775
|
/**
|
|
475
776
|
* Computer-use action payload for capturing the current display.
|
|
476
777
|
*
|
|
477
|
-
* @category
|
|
778
|
+
* @category computer use
|
|
478
779
|
* @since 4.0.0
|
|
479
780
|
*/
|
|
480
781
|
export type ComputerUseScreenshotAction = typeof ComputerUseScreenshotAction.Type
|
|
481
782
|
|
|
482
783
|
/**
|
|
483
|
-
*
|
|
784
|
+
* Schema for a computer-use action that enters text.
|
|
785
|
+
*
|
|
786
|
+
* **When to use**
|
|
484
787
|
*
|
|
485
|
-
*
|
|
788
|
+
* Use to validate or construct a computer-use action for entering ordinary text
|
|
789
|
+
* strings.
|
|
790
|
+
*
|
|
791
|
+
* **Details**
|
|
792
|
+
*
|
|
793
|
+
* The payload uses `action: "type"` and a `text` string containing the text to
|
|
794
|
+
* enter.
|
|
795
|
+
*
|
|
796
|
+
* @see {@link ComputerUseKeyAction} for key presses and keyboard shortcuts
|
|
797
|
+
*
|
|
798
|
+
* @category computer use
|
|
486
799
|
* @since 4.0.0
|
|
487
800
|
*/
|
|
488
801
|
export const TypeAction = Schema.Struct({
|
|
@@ -495,7 +808,12 @@ export const TypeAction = Schema.Struct({
|
|
|
495
808
|
/**
|
|
496
809
|
* Computer-use action payload for typing a text string.
|
|
497
810
|
*
|
|
498
|
-
*
|
|
811
|
+
* **Details**
|
|
812
|
+
*
|
|
813
|
+
* The payload uses `action: "type"` and a `text` string containing the text to
|
|
814
|
+
* enter.
|
|
815
|
+
*
|
|
816
|
+
* @category computer use
|
|
499
817
|
* @since 4.0.0
|
|
500
818
|
*/
|
|
501
819
|
export type TypeAction = typeof TypeAction.Type
|
|
@@ -513,9 +831,28 @@ const ComputerUse_20241022_Actions = Schema.Union([
|
|
|
513
831
|
// -----------------------------------------------------------------------------
|
|
514
832
|
|
|
515
833
|
/**
|
|
516
|
-
*
|
|
834
|
+
* Schema for a computer-use action that performs a double click.
|
|
835
|
+
*
|
|
836
|
+
* **When to use**
|
|
837
|
+
*
|
|
838
|
+
* Use to validate or construct an Anthropic computer-use payload for double
|
|
839
|
+
* clicking at the current mouse position or at a specific screen coordinate.
|
|
840
|
+
*
|
|
841
|
+
* **Details**
|
|
842
|
+
*
|
|
843
|
+
* The encoded payload uses `action: "double_click"`. The optional
|
|
844
|
+
* `coordinate` field supplies the `[x, y]` pixel position; when omitted, the
|
|
845
|
+
* action uses the current mouse position.
|
|
846
|
+
*
|
|
847
|
+
* **Gotchas**
|
|
517
848
|
*
|
|
518
|
-
*
|
|
849
|
+
* The coordinate schema only checks that the value is a two-number tuple. It
|
|
850
|
+
* does not validate that the point falls within the configured display
|
|
851
|
+
* dimensions.
|
|
852
|
+
*
|
|
853
|
+
* @see {@link ComputerUseLeftClickAction} for performing a single left click
|
|
854
|
+
*
|
|
855
|
+
* @category computer use
|
|
519
856
|
* @since 4.0.0
|
|
520
857
|
*/
|
|
521
858
|
export const ComputerUseDoubleClickAction = Schema.Struct({
|
|
@@ -529,15 +866,34 @@ export const ComputerUseDoubleClickAction = Schema.Struct({
|
|
|
529
866
|
/**
|
|
530
867
|
* Computer-use action payload for performing a double click, optionally at a specific coordinate.
|
|
531
868
|
*
|
|
532
|
-
* @category
|
|
869
|
+
* @category computer use
|
|
533
870
|
* @since 4.0.0
|
|
534
871
|
*/
|
|
535
872
|
export type ComputerUseDoubleClickAction = typeof ComputerUseDoubleClickAction.Type
|
|
536
873
|
|
|
537
874
|
/**
|
|
538
|
-
*
|
|
875
|
+
* Keeps a key pressed for a specified duration during computer-use execution.
|
|
876
|
+
*
|
|
877
|
+
* **When to use**
|
|
878
|
+
*
|
|
879
|
+
* Use to keep a keyboard key depressed for a fixed number of seconds in a
|
|
880
|
+
* computer-use action sequence.
|
|
881
|
+
*
|
|
882
|
+
* **Details**
|
|
883
|
+
*
|
|
884
|
+
* The schema describes objects with `action: "hold_key"`, a `text` field
|
|
885
|
+
* containing the key to hold, and a `duration` field containing the number of
|
|
886
|
+
* seconds to hold it.
|
|
887
|
+
*
|
|
888
|
+
* **Gotchas**
|
|
889
|
+
*
|
|
890
|
+
* The schema only checks that `duration` is a number; it does not require a
|
|
891
|
+
* positive value.
|
|
539
892
|
*
|
|
540
|
-
* @
|
|
893
|
+
* @see {@link ComputerUseKeyAction} for pressing a key or key combination without holding it
|
|
894
|
+
* @see {@link ComputerUseWaitAction} for pausing between actions without holding a key
|
|
895
|
+
*
|
|
896
|
+
* @category computer use
|
|
541
897
|
* @since 4.0.0
|
|
542
898
|
*/
|
|
543
899
|
export const ComputerUseHoldKeyAction = Schema.Struct({
|
|
@@ -554,15 +910,45 @@ export const ComputerUseHoldKeyAction = Schema.Struct({
|
|
|
554
910
|
/**
|
|
555
911
|
* Computer-use action payload for holding a key for a specified duration.
|
|
556
912
|
*
|
|
557
|
-
*
|
|
913
|
+
* **When to use**
|
|
914
|
+
*
|
|
915
|
+
* Use to represent a key that should remain pressed for a measured interval.
|
|
916
|
+
*
|
|
917
|
+
* **Details**
|
|
918
|
+
*
|
|
919
|
+
* Set `action` to `"hold_key"`, `text` to the key to hold, and `duration` to
|
|
920
|
+
* the number of seconds to hold it.
|
|
921
|
+
*
|
|
922
|
+
* @see {@link ComputerUseKeyAction} for a single key press or key combination without a hold duration
|
|
923
|
+
*
|
|
924
|
+
* @category computer use
|
|
558
925
|
* @since 4.0.0
|
|
559
926
|
*/
|
|
560
927
|
export type ComputerUseHoldKeyAction = typeof ComputerUseHoldKeyAction.Type
|
|
561
928
|
|
|
562
929
|
/**
|
|
563
|
-
*
|
|
930
|
+
* Schema for a computer-use action that drags with the left mouse button.
|
|
931
|
+
*
|
|
932
|
+
* **When to use**
|
|
933
|
+
*
|
|
934
|
+
* Use to validate or construct an Anthropic computer-use payload for dragging
|
|
935
|
+
* from one screen coordinate to another in a single action.
|
|
564
936
|
*
|
|
565
|
-
*
|
|
937
|
+
* **Details**
|
|
938
|
+
*
|
|
939
|
+
* The encoded payload uses `action: "left_click_drag"` and requires both
|
|
940
|
+
* `start_coordinate` and `coordinate` as `[x, y]` pixel positions.
|
|
941
|
+
*
|
|
942
|
+
* **Gotchas**
|
|
943
|
+
*
|
|
944
|
+
* The coordinate schema only checks that each value is a two-number tuple. It
|
|
945
|
+
* does not validate that either point falls within the configured display
|
|
946
|
+
* dimensions.
|
|
947
|
+
*
|
|
948
|
+
* @see {@link ComputerUseLeftMouseDownAction} for starting a manual drag sequence
|
|
949
|
+
* @see {@link ComputerUseLeftMouseUpAction} for ending a manual drag sequence
|
|
950
|
+
*
|
|
951
|
+
* @category computer use
|
|
566
952
|
* @since 4.0.0
|
|
567
953
|
*/
|
|
568
954
|
export const ComputerUseLeftClickDragAction = Schema.Struct({
|
|
@@ -579,19 +965,20 @@ export const ComputerUseLeftClickDragAction = Schema.Struct({
|
|
|
579
965
|
/**
|
|
580
966
|
* Computer-use action payload for dragging from a start coordinate to an end coordinate.
|
|
581
967
|
*
|
|
582
|
-
* @category
|
|
968
|
+
* @category computer use
|
|
583
969
|
* @since 4.0.0
|
|
584
970
|
*/
|
|
585
971
|
export type ComputerUseLeftClickDragAction = typeof ComputerUseLeftClickDragAction.Type
|
|
586
972
|
|
|
587
973
|
/**
|
|
588
|
-
*
|
|
974
|
+
* Starts a left mouse button press without releasing it.
|
|
589
975
|
*
|
|
590
976
|
* **When to use**
|
|
591
977
|
*
|
|
592
|
-
* Use
|
|
978
|
+
* Use when constructing a manual click or drag sequence that should press and
|
|
979
|
+
* hold the left mouse button before a later release.
|
|
593
980
|
*
|
|
594
|
-
* @category
|
|
981
|
+
* @category computer use
|
|
595
982
|
* @since 4.0.0
|
|
596
983
|
*/
|
|
597
984
|
export const ComputerUseLeftMouseDownAction = Schema.Struct({
|
|
@@ -605,19 +992,20 @@ export const ComputerUseLeftMouseDownAction = Schema.Struct({
|
|
|
605
992
|
/**
|
|
606
993
|
* Computer-use action payload for pressing and holding the left mouse button, optionally at a specific coordinate.
|
|
607
994
|
*
|
|
608
|
-
* @category
|
|
995
|
+
* @category computer use
|
|
609
996
|
* @since 4.0.0
|
|
610
997
|
*/
|
|
611
998
|
export type ComputerUseLeftMouseDownAction = typeof ComputerUseLeftMouseDownAction.Type
|
|
612
999
|
|
|
613
1000
|
/**
|
|
614
|
-
*
|
|
1001
|
+
* Releases the left mouse button.
|
|
615
1002
|
*
|
|
616
1003
|
* **When to use**
|
|
617
1004
|
*
|
|
618
|
-
* Use
|
|
1005
|
+
* Use when constructing a manual click or drag sequence that should release the
|
|
1006
|
+
* left mouse button after it was previously held down.
|
|
619
1007
|
*
|
|
620
|
-
* @category
|
|
1008
|
+
* @category computer use
|
|
621
1009
|
* @since 4.0.0
|
|
622
1010
|
*/
|
|
623
1011
|
export const ComputerUseLeftMouseUpAction = Schema.Struct({
|
|
@@ -631,15 +1019,34 @@ export const ComputerUseLeftMouseUpAction = Schema.Struct({
|
|
|
631
1019
|
/**
|
|
632
1020
|
* Computer-use action payload for releasing the left mouse button, optionally at a specific coordinate.
|
|
633
1021
|
*
|
|
634
|
-
* @category
|
|
1022
|
+
* @category computer use
|
|
635
1023
|
* @since 4.0.0
|
|
636
1024
|
*/
|
|
637
1025
|
export type ComputerUseLeftMouseUpAction = typeof ComputerUseLeftMouseUpAction.Type
|
|
638
1026
|
|
|
639
1027
|
/**
|
|
640
|
-
*
|
|
1028
|
+
* Schema for a computer-use action that performs a middle click.
|
|
1029
|
+
*
|
|
1030
|
+
* **When to use**
|
|
1031
|
+
*
|
|
1032
|
+
* Use to validate or construct a middle-button click action for Anthropic
|
|
1033
|
+
* computer use, optionally targeting a specific screen coordinate.
|
|
1034
|
+
*
|
|
1035
|
+
* **Details**
|
|
1036
|
+
*
|
|
1037
|
+
* The payload must use `action: "middle_click"`. When `coordinate` is omitted,
|
|
1038
|
+
* the click occurs at the current mouse position.
|
|
641
1039
|
*
|
|
642
|
-
*
|
|
1040
|
+
* **Gotchas**
|
|
1041
|
+
*
|
|
1042
|
+
* This action is available in the 2025-01-24 computer-use action set and later;
|
|
1043
|
+
* it is not part of `ComputerUse_20241022`.
|
|
1044
|
+
*
|
|
1045
|
+
* @see {@link ComputerUse_20250124} for the provider-defined tool version that first accepts this action
|
|
1046
|
+
* @see {@link ComputerUseLeftClickAction} for primary-button clicks
|
|
1047
|
+
* @see {@link ComputerUseRightClickAction} for secondary-button clicks
|
|
1048
|
+
*
|
|
1049
|
+
* @category computer use
|
|
643
1050
|
* @since 4.0.0
|
|
644
1051
|
*/
|
|
645
1052
|
export const ComputerUseMiddleClickAction = Schema.Struct({
|
|
@@ -653,15 +1060,30 @@ export const ComputerUseMiddleClickAction = Schema.Struct({
|
|
|
653
1060
|
/**
|
|
654
1061
|
* Computer-use action payload for performing a middle click, optionally at a specific coordinate.
|
|
655
1062
|
*
|
|
656
|
-
* @category
|
|
1063
|
+
* @category computer use
|
|
657
1064
|
* @since 4.0.0
|
|
658
1065
|
*/
|
|
659
1066
|
export type ComputerUseMiddleClickAction = typeof ComputerUseMiddleClickAction.Type
|
|
660
1067
|
|
|
661
1068
|
/**
|
|
662
|
-
*
|
|
1069
|
+
* Schema for a computer-use action that performs a right click, optionally at a
|
|
1070
|
+
* specific screen coordinate.
|
|
1071
|
+
*
|
|
1072
|
+
* **When to use**
|
|
663
1073
|
*
|
|
664
|
-
*
|
|
1074
|
+
* Use to validate or construct the `right_click` action for an Anthropic
|
|
1075
|
+
* computer-use tool call.
|
|
1076
|
+
*
|
|
1077
|
+
* **Details**
|
|
1078
|
+
*
|
|
1079
|
+
* The optional `coordinate` field is an `[x, y]` screen coordinate in pixels.
|
|
1080
|
+
* When omitted, the right click is performed at the current mouse position.
|
|
1081
|
+
*
|
|
1082
|
+
* @see {@link ComputerUse_20250124} for the provider-defined computer-use tool version that introduced this action
|
|
1083
|
+
* @see {@link ComputerUseLeftClickAction} for the corresponding left-click action
|
|
1084
|
+
* @see {@link ComputerUseMiddleClickAction} for the corresponding middle-click action
|
|
1085
|
+
*
|
|
1086
|
+
* @category computer use
|
|
665
1087
|
* @since 4.0.0
|
|
666
1088
|
*/
|
|
667
1089
|
export const ComputerUseRightClickAction = Schema.Struct({
|
|
@@ -675,15 +1097,32 @@ export const ComputerUseRightClickAction = Schema.Struct({
|
|
|
675
1097
|
/**
|
|
676
1098
|
* Computer-use action payload for performing a right click, optionally at a specific coordinate.
|
|
677
1099
|
*
|
|
678
|
-
* @category
|
|
1100
|
+
* @category computer use
|
|
679
1101
|
* @since 4.0.0
|
|
680
1102
|
*/
|
|
681
1103
|
export type ComputerUseRightClickAction = typeof ComputerUseRightClickAction.Type
|
|
682
1104
|
|
|
683
1105
|
/**
|
|
684
|
-
*
|
|
1106
|
+
* Schema for a computer-use scroll action.
|
|
1107
|
+
*
|
|
1108
|
+
* **When to use**
|
|
1109
|
+
*
|
|
1110
|
+
* Use when validating or constructing Anthropic computer-use scroll payloads.
|
|
1111
|
+
*
|
|
1112
|
+
* **Details**
|
|
1113
|
+
*
|
|
1114
|
+
* The encoded payload uses `action: "scroll"`, an optional `coordinate`,
|
|
1115
|
+
* `scroll_direction`, and `scroll_amount`.
|
|
1116
|
+
*
|
|
1117
|
+
* **Gotchas**
|
|
685
1118
|
*
|
|
686
|
-
*
|
|
1119
|
+
* `coordinate` only checks a two-number tuple, and `scroll_amount` is only
|
|
1120
|
+
* `Schema.Number`.
|
|
1121
|
+
*
|
|
1122
|
+
* @see {@link ComputerUse_20250124} for the tool version that accepts this action
|
|
1123
|
+
* @see {@link ScrollDirection} for the accepted direction literals
|
|
1124
|
+
*
|
|
1125
|
+
* @category computer use
|
|
687
1126
|
* @since 4.0.0
|
|
688
1127
|
*/
|
|
689
1128
|
export const ComputerUseScrollAction = Schema.Struct({
|
|
@@ -705,15 +1144,34 @@ export const ComputerUseScrollAction = Schema.Struct({
|
|
|
705
1144
|
/**
|
|
706
1145
|
* Computer-use action payload for scrolling by a specified amount in a specified direction, optionally from a coordinate.
|
|
707
1146
|
*
|
|
708
|
-
* @category
|
|
1147
|
+
* @category computer use
|
|
709
1148
|
* @since 4.0.0
|
|
710
1149
|
*/
|
|
711
1150
|
export type ComputerUseScrollAction = typeof ComputerUseScrollAction.Type
|
|
712
1151
|
|
|
713
1152
|
/**
|
|
714
|
-
*
|
|
1153
|
+
* Schema for a computer-use triple-click action.
|
|
1154
|
+
*
|
|
1155
|
+
* **When to use**
|
|
1156
|
+
*
|
|
1157
|
+
* Use when validating or constructing Anthropic computer-use triple-click
|
|
1158
|
+
* payloads at the current pointer position or an optional coordinate.
|
|
1159
|
+
*
|
|
1160
|
+
* **Details**
|
|
1161
|
+
*
|
|
1162
|
+
* The encoded payload uses `action: "triple_click"` and an optional
|
|
1163
|
+
* `coordinate`.
|
|
1164
|
+
*
|
|
1165
|
+
* **Gotchas**
|
|
715
1166
|
*
|
|
716
|
-
*
|
|
1167
|
+
* `coordinate` only validates as a two-number tuple and does not check display
|
|
1168
|
+
* bounds.
|
|
1169
|
+
*
|
|
1170
|
+
* @see {@link ComputerUse_20250124} for the tool version that accepts this action
|
|
1171
|
+
* @see {@link ComputerUseDoubleClickAction} for the two-click variant
|
|
1172
|
+
* @see {@link ComputerUseLeftClickAction} for a single left click
|
|
1173
|
+
*
|
|
1174
|
+
* @category computer use
|
|
717
1175
|
* @since 4.0.0
|
|
718
1176
|
*/
|
|
719
1177
|
export const ComputerUseTripleClickAction = Schema.Struct({
|
|
@@ -727,15 +1185,33 @@ export const ComputerUseTripleClickAction = Schema.Struct({
|
|
|
727
1185
|
/**
|
|
728
1186
|
* Computer-use action payload for performing a triple click, optionally at a specific coordinate.
|
|
729
1187
|
*
|
|
730
|
-
* @category
|
|
1188
|
+
* @category computer use
|
|
731
1189
|
* @since 4.0.0
|
|
732
1190
|
*/
|
|
733
1191
|
export type ComputerUseTripleClickAction = typeof ComputerUseTripleClickAction.Type
|
|
734
1192
|
|
|
735
1193
|
/**
|
|
736
|
-
*
|
|
1194
|
+
* Schema for a computer-use wait action.
|
|
737
1195
|
*
|
|
738
|
-
*
|
|
1196
|
+
* **When to use**
|
|
1197
|
+
*
|
|
1198
|
+
* Use when validating or constructing Anthropic computer-use payloads that pause
|
|
1199
|
+
* between actions.
|
|
1200
|
+
*
|
|
1201
|
+
* **Details**
|
|
1202
|
+
*
|
|
1203
|
+
* The encoded payload uses `action: "wait"` and a required `duration` in
|
|
1204
|
+
* seconds.
|
|
1205
|
+
*
|
|
1206
|
+
* **Gotchas**
|
|
1207
|
+
*
|
|
1208
|
+
* `duration` is only `Schema.Number`; it is not constrained to positive or
|
|
1209
|
+
* finite values.
|
|
1210
|
+
*
|
|
1211
|
+
* @see {@link ComputerUseHoldKeyAction} for another duration-based computer-use action
|
|
1212
|
+
* @see {@link ComputerUse_20250124} for the tool version that accepts this action
|
|
1213
|
+
*
|
|
1214
|
+
* @category computer use
|
|
739
1215
|
* @since 4.0.0
|
|
740
1216
|
*/
|
|
741
1217
|
export const ComputerUseWaitAction = Schema.Struct({
|
|
@@ -748,7 +1224,7 @@ export const ComputerUseWaitAction = Schema.Struct({
|
|
|
748
1224
|
/**
|
|
749
1225
|
* Computer-use action payload for pausing for a specified duration.
|
|
750
1226
|
*
|
|
751
|
-
* @category
|
|
1227
|
+
* @category computer use
|
|
752
1228
|
* @since 4.0.0
|
|
753
1229
|
*/
|
|
754
1230
|
export type ComputerUseWaitAction = typeof ComputerUseWaitAction.Type
|
|
@@ -772,13 +1248,21 @@ const ComputerUse_20250124_Actions = Schema.Union([
|
|
|
772
1248
|
// -----------------------------------------------------------------------------
|
|
773
1249
|
|
|
774
1250
|
/**
|
|
775
|
-
*
|
|
1251
|
+
* Zooms into a specific region of the screen at full resolution.
|
|
776
1252
|
*
|
|
777
1253
|
* **Details**
|
|
778
1254
|
*
|
|
779
|
-
*
|
|
1255
|
+
* The encoded payload uses `action: "zoom"` and a `region` tuple.
|
|
1256
|
+
*
|
|
1257
|
+
* **Gotchas**
|
|
1258
|
+
*
|
|
1259
|
+
* Requires `enableZoom: true` in the tool definition. `region` is only a
|
|
1260
|
+
* four-number tuple and does not validate corner ordering or display bounds.
|
|
1261
|
+
*
|
|
1262
|
+
* @see {@link ComputerUse_20251124} for the tool version that accepts this action
|
|
1263
|
+
* @see {@link ComputerUseScreenshotAction} for capturing the full screen instead
|
|
780
1264
|
*
|
|
781
|
-
* @category
|
|
1265
|
+
* @category computer use
|
|
782
1266
|
* @since 4.0.0
|
|
783
1267
|
*/
|
|
784
1268
|
export const ComputerUseZoomAction = Schema.Struct({
|
|
@@ -792,11 +1276,13 @@ export const ComputerUseZoomAction = Schema.Struct({
|
|
|
792
1276
|
/**
|
|
793
1277
|
* Computer-use action payload for zooming into a specific screen region.
|
|
794
1278
|
*
|
|
795
|
-
* **
|
|
1279
|
+
* **Gotchas**
|
|
796
1280
|
*
|
|
797
1281
|
* The enclosing computer-use tool must be configured with `enableZoom: true`.
|
|
1282
|
+
* `region` is only a four-number tuple and does not validate corner ordering or
|
|
1283
|
+
* display bounds.
|
|
798
1284
|
*
|
|
799
|
-
* @category
|
|
1285
|
+
* @category computer use
|
|
800
1286
|
* @since 4.0.0
|
|
801
1287
|
*/
|
|
802
1288
|
export type ComputerUseZoomAction = typeof ComputerUseZoomAction.Type
|
|
@@ -811,14 +1297,14 @@ const ComputerUse_20251124_Actions = Schema.Union([
|
|
|
811
1297
|
// -----------------------------------------------------------------------------
|
|
812
1298
|
|
|
813
1299
|
/**
|
|
814
|
-
*
|
|
1300
|
+
* Defines the deprecated computer-use tool for Claude 3.5 Sonnet v2.
|
|
815
1301
|
*
|
|
816
1302
|
* **Details**
|
|
817
1303
|
*
|
|
818
1304
|
* Requires the "computer-use-2024-10-22" beta header.
|
|
819
1305
|
* Basic actions only: screenshot, left_click, type, key, mouse_move.
|
|
820
1306
|
*
|
|
821
|
-
* @category
|
|
1307
|
+
* @category computer use
|
|
822
1308
|
* @since 4.0.0
|
|
823
1309
|
*/
|
|
824
1310
|
export const ComputerUse_20241022 = Tool.providerDefined({
|
|
@@ -832,7 +1318,12 @@ export const ComputerUse_20241022 = Tool.providerDefined({
|
|
|
832
1318
|
})
|
|
833
1319
|
|
|
834
1320
|
/**
|
|
835
|
-
*
|
|
1321
|
+
* Defines the computer-use tool for Claude 4 models and Claude Sonnet 3.7.
|
|
1322
|
+
*
|
|
1323
|
+
* **When to use**
|
|
1324
|
+
*
|
|
1325
|
+
* Use when configuring Anthropic computer use for Claude 4 models or Claude
|
|
1326
|
+
* Sonnet 3.7 with the 2025-01-24 action set.
|
|
836
1327
|
*
|
|
837
1328
|
* **Details**
|
|
838
1329
|
*
|
|
@@ -841,7 +1332,10 @@ export const ComputerUse_20241022 = Tool.providerDefined({
|
|
|
841
1332
|
* right_click, middle_click, double_click, triple_click, left_mouse_down,
|
|
842
1333
|
* left_mouse_up, hold_key, wait.
|
|
843
1334
|
*
|
|
844
|
-
* @
|
|
1335
|
+
* @see {@link ComputerUse_20241022} for the older basic action set
|
|
1336
|
+
* @see {@link ComputerUse_20251124} for the newer zoom-capable version
|
|
1337
|
+
*
|
|
1338
|
+
* @category computer use
|
|
845
1339
|
* @since 4.0.0
|
|
846
1340
|
*/
|
|
847
1341
|
export const ComputerUse_20250124 = Tool.providerDefined({
|
|
@@ -855,15 +1349,27 @@ export const ComputerUse_20250124 = Tool.providerDefined({
|
|
|
855
1349
|
})
|
|
856
1350
|
|
|
857
1351
|
/**
|
|
858
|
-
*
|
|
1352
|
+
* Defines the computer-use tool for Claude Opus 4.5 only.
|
|
1353
|
+
*
|
|
1354
|
+
* **When to use**
|
|
1355
|
+
*
|
|
1356
|
+
* Use when configuring Anthropic computer use for Claude Opus 4.5 with the
|
|
1357
|
+
* 2025-11-24 action set and zoom-capable screen inspection.
|
|
859
1358
|
*
|
|
860
1359
|
* **Details**
|
|
861
1360
|
*
|
|
862
1361
|
* Requires the "computer-use-2025-11-24" beta header.
|
|
863
1362
|
* Includes all actions from computer_20250124 plus the zoom action for
|
|
864
|
-
* detailed screen region inspection.
|
|
1363
|
+
* detailed screen region inspection.
|
|
1364
|
+
*
|
|
1365
|
+
* **Gotchas**
|
|
1366
|
+
*
|
|
1367
|
+
* Zoom actions require `enableZoom: true` in args.
|
|
865
1368
|
*
|
|
866
|
-
* @
|
|
1369
|
+
* @see {@link ComputerUse_20250124} for the previous action set without zoom
|
|
1370
|
+
* @see {@link ComputerUseZoomAction} for the zoom action payload
|
|
1371
|
+
*
|
|
1372
|
+
* @category computer use
|
|
867
1373
|
* @since 4.0.0
|
|
868
1374
|
*/
|
|
869
1375
|
export const ComputerUse_20251124 = Tool.providerDefined({
|
|
@@ -885,22 +1391,34 @@ export const ComputerUse_20251124 = Tool.providerDefined({
|
|
|
885
1391
|
// -----------------------------------------------------------------------------
|
|
886
1392
|
|
|
887
1393
|
/**
|
|
888
|
-
*
|
|
1394
|
+
* Defines a `[start, end]` line range for viewing file contents.
|
|
1395
|
+
*
|
|
1396
|
+
* **When to use**
|
|
1397
|
+
*
|
|
1398
|
+
* Use when constructing or validating `view_range` for memory or text editor
|
|
1399
|
+
* view commands.
|
|
889
1400
|
*
|
|
890
1401
|
* **Details**
|
|
891
1402
|
*
|
|
892
|
-
* Lines are 1-indexed. Use
|
|
1403
|
+
* Lines are 1-indexed. Use `-1` for end to read to the end of the file. For
|
|
893
1404
|
* example, `[1, 50]` views lines 1-50 and `[100, -1]` views from line 100 to
|
|
894
1405
|
* the end of the file.
|
|
895
1406
|
*
|
|
896
|
-
* @
|
|
1407
|
+
* @see {@link MemoryViewCommand} for memory view payloads that use this range
|
|
1408
|
+
* @see {@link TextEditorViewCommand} for text editor view payloads that use this range
|
|
1409
|
+
*
|
|
1410
|
+
* @category memory
|
|
897
1411
|
* @since 4.0.0
|
|
898
1412
|
*/
|
|
899
1413
|
export const ViewRange = Schema.Tuple([Schema.Number, Schema.Number])
|
|
900
1414
|
/**
|
|
901
1415
|
* A `[start, end]` 1-indexed line range for viewing file contents, using `-1` as the end value to read through the end of the file.
|
|
902
1416
|
*
|
|
903
|
-
*
|
|
1417
|
+
* **When to use**
|
|
1418
|
+
*
|
|
1419
|
+
* Use when typing `view_range` for memory or text editor view commands.
|
|
1420
|
+
*
|
|
1421
|
+
* @category memory
|
|
904
1422
|
* @since 4.0.0
|
|
905
1423
|
*/
|
|
906
1424
|
export type ViewRange = typeof ViewRange.Type
|
|
@@ -910,9 +1428,13 @@ export type ViewRange = typeof ViewRange.Type
|
|
|
910
1428
|
// -----------------------------------------------------------------------------
|
|
911
1429
|
|
|
912
1430
|
/**
|
|
913
|
-
*
|
|
1431
|
+
* Schema for the memory tool command that creates a new file at a path.
|
|
1432
|
+
*
|
|
1433
|
+
* **Details**
|
|
914
1434
|
*
|
|
915
|
-
*
|
|
1435
|
+
* The payload contains `command: "create"` and a `path` string.
|
|
1436
|
+
*
|
|
1437
|
+
* @category memory
|
|
916
1438
|
* @since 4.0.0
|
|
917
1439
|
*/
|
|
918
1440
|
export const MemoryCreateCommand = Schema.Struct({
|
|
@@ -925,36 +1447,48 @@ export const MemoryCreateCommand = Schema.Struct({
|
|
|
925
1447
|
/**
|
|
926
1448
|
* Memory tool command payload for creating a new file at a path.
|
|
927
1449
|
*
|
|
928
|
-
* @category
|
|
1450
|
+
* @category memory
|
|
929
1451
|
* @since 4.0.0
|
|
930
1452
|
*/
|
|
931
1453
|
export type MemoryCreateCommand = typeof MemoryCreateCommand.Type
|
|
932
1454
|
|
|
933
1455
|
/**
|
|
934
|
-
*
|
|
1456
|
+
* Schema for a memory command that deletes a file or directory.
|
|
935
1457
|
*
|
|
936
|
-
* @category
|
|
1458
|
+
* @category memory
|
|
937
1459
|
* @since 4.0.0
|
|
938
1460
|
*/
|
|
939
1461
|
export const MemoryDeleteCommand = Schema.Struct({
|
|
940
1462
|
command: Schema.Literal("delete"),
|
|
941
1463
|
/**
|
|
942
|
-
* The path to the file to delete.
|
|
1464
|
+
* The path to the file or directory to delete.
|
|
943
1465
|
*/
|
|
944
1466
|
path: Schema.String
|
|
945
1467
|
})
|
|
946
1468
|
/**
|
|
947
1469
|
* Memory tool command payload for deleting a file or directory at a path.
|
|
948
1470
|
*
|
|
949
|
-
* @category
|
|
1471
|
+
* @category memory
|
|
950
1472
|
* @since 4.0.0
|
|
951
1473
|
*/
|
|
952
1474
|
export type MemoryDeleteCommand = typeof MemoryDeleteCommand.Type
|
|
953
1475
|
|
|
954
1476
|
/**
|
|
955
|
-
*
|
|
1477
|
+
* Schema for the memory `insert` command.
|
|
1478
|
+
*
|
|
1479
|
+
* **When to use**
|
|
956
1480
|
*
|
|
957
|
-
*
|
|
1481
|
+
* Use when validating or constructing `insert` payloads for `Memory_20250818`.
|
|
1482
|
+
*
|
|
1483
|
+
* **Details**
|
|
1484
|
+
*
|
|
1485
|
+
* The payload is discriminated by `command: "insert"` and requires `path`,
|
|
1486
|
+
* `insert_line`, and `insert_text`.
|
|
1487
|
+
*
|
|
1488
|
+
* @see {@link Memory_20250818} for the provider-defined tool that consumes this command
|
|
1489
|
+
* @see {@link MemoryStrReplaceCommand} for replacing existing text instead
|
|
1490
|
+
*
|
|
1491
|
+
* @category memory
|
|
958
1492
|
* @since 4.0.0
|
|
959
1493
|
*/
|
|
960
1494
|
export const MemoryInsertCommand = Schema.Struct({
|
|
@@ -975,15 +1509,20 @@ export const MemoryInsertCommand = Schema.Struct({
|
|
|
975
1509
|
/**
|
|
976
1510
|
* Memory tool command payload for inserting text at a specific line in a file.
|
|
977
1511
|
*
|
|
978
|
-
* @category
|
|
1512
|
+
* @category memory
|
|
979
1513
|
* @since 4.0.0
|
|
980
1514
|
*/
|
|
981
1515
|
export type MemoryInsertCommand = typeof MemoryInsertCommand.Type
|
|
982
1516
|
|
|
983
1517
|
/**
|
|
984
|
-
*
|
|
1518
|
+
* Schema for the memory command that renames or moves a file or directory.
|
|
1519
|
+
*
|
|
1520
|
+
* **Details**
|
|
1521
|
+
*
|
|
1522
|
+
* The payload uses `command: "rename"` and requires `old_path` as the current
|
|
1523
|
+
* path plus `new_path` as the new destination path.
|
|
985
1524
|
*
|
|
986
|
-
* @category
|
|
1525
|
+
* @category memory
|
|
987
1526
|
* @since 4.0.0
|
|
988
1527
|
*/
|
|
989
1528
|
export const MemoryRenameCommand = Schema.Struct({
|
|
@@ -1000,15 +1539,27 @@ export const MemoryRenameCommand = Schema.Struct({
|
|
|
1000
1539
|
/**
|
|
1001
1540
|
* Memory tool command payload for renaming or moving a file or directory.
|
|
1002
1541
|
*
|
|
1003
|
-
* @category
|
|
1542
|
+
* @category memory
|
|
1004
1543
|
* @since 4.0.0
|
|
1005
1544
|
*/
|
|
1006
1545
|
export type MemoryRenameCommand = typeof MemoryRenameCommand.Type
|
|
1007
1546
|
|
|
1008
1547
|
/**
|
|
1009
|
-
*
|
|
1548
|
+
* Schema for the memory `str_replace` command.
|
|
1549
|
+
*
|
|
1550
|
+
* **When to use**
|
|
1551
|
+
*
|
|
1552
|
+
* Use when validating or constructing `str_replace` payloads for
|
|
1553
|
+
* `Memory_20250818`.
|
|
1554
|
+
*
|
|
1555
|
+
* **Details**
|
|
1010
1556
|
*
|
|
1011
|
-
*
|
|
1557
|
+
* The payload is discriminated by `command: "str_replace"` and requires `path`,
|
|
1558
|
+
* `old_str`, and `new_str`.
|
|
1559
|
+
*
|
|
1560
|
+
* @see {@link Memory_20250818} for the provider-defined tool that consumes this command
|
|
1561
|
+
*
|
|
1562
|
+
* @category memory
|
|
1012
1563
|
* @since 4.0.0
|
|
1013
1564
|
*/
|
|
1014
1565
|
export const MemoryStrReplaceCommand = Schema.Struct({
|
|
@@ -1029,7 +1580,7 @@ export const MemoryStrReplaceCommand = Schema.Struct({
|
|
|
1029
1580
|
/**
|
|
1030
1581
|
* Memory tool command payload for replacing text in a file.
|
|
1031
1582
|
*
|
|
1032
|
-
* @category
|
|
1583
|
+
* @category memory
|
|
1033
1584
|
* @since 4.0.0
|
|
1034
1585
|
*/
|
|
1035
1586
|
export type MemoryStrReplaceCommand = typeof MemoryStrReplaceCommand.Type
|
|
@@ -1037,13 +1588,18 @@ export type MemoryStrReplaceCommand = typeof MemoryStrReplaceCommand.Type
|
|
|
1037
1588
|
/**
|
|
1038
1589
|
* Shows directory contents or file contents with optional line ranges.
|
|
1039
1590
|
*
|
|
1040
|
-
*
|
|
1591
|
+
* **Details**
|
|
1592
|
+
*
|
|
1593
|
+
* When used on a file, returns file contents optionally limited by `view_range`.
|
|
1594
|
+
* When used on a directory, lists contents.
|
|
1595
|
+
*
|
|
1596
|
+
* @category memory
|
|
1041
1597
|
* @since 4.0.0
|
|
1042
1598
|
*/
|
|
1043
1599
|
export const MemoryViewCommand = Schema.Struct({
|
|
1044
1600
|
command: Schema.Literal("view"),
|
|
1045
1601
|
/**
|
|
1046
|
-
* The path to the file to view.
|
|
1602
|
+
* The path to the file or directory to view.
|
|
1047
1603
|
*/
|
|
1048
1604
|
path: Schema.String,
|
|
1049
1605
|
/**
|
|
@@ -1054,7 +1610,7 @@ export const MemoryViewCommand = Schema.Struct({
|
|
|
1054
1610
|
/**
|
|
1055
1611
|
* Memory tool command payload for viewing a file or directory, optionally with a file line range.
|
|
1056
1612
|
*
|
|
1057
|
-
* @category
|
|
1613
|
+
* @category memory
|
|
1058
1614
|
* @since 4.0.0
|
|
1059
1615
|
*/
|
|
1060
1616
|
export type MemoryViewCommand = typeof MemoryViewCommand.Type
|
|
@@ -1073,14 +1629,14 @@ const Memory_20250818_Commands = Schema.Union([
|
|
|
1073
1629
|
// -----------------------------------------------------------------------------
|
|
1074
1630
|
|
|
1075
1631
|
/**
|
|
1076
|
-
*
|
|
1632
|
+
* Defines the memory tool for persistent file operations across conversations.
|
|
1077
1633
|
*
|
|
1078
1634
|
* **Details**
|
|
1079
1635
|
*
|
|
1080
1636
|
* Provides commands for creating, viewing, editing, renaming, and deleting
|
|
1081
1637
|
* files within the model's memory space.
|
|
1082
1638
|
*
|
|
1083
|
-
* @category
|
|
1639
|
+
* @category memory
|
|
1084
1640
|
* @since 4.0.0
|
|
1085
1641
|
*/
|
|
1086
1642
|
export const Memory_20250818 = Tool.providerDefined({
|
|
@@ -1100,14 +1656,23 @@ export const Memory_20250818 = Tool.providerDefined({
|
|
|
1100
1656
|
// -----------------------------------------------------------------------------
|
|
1101
1657
|
|
|
1102
1658
|
/**
|
|
1103
|
-
*
|
|
1659
|
+
* Reads the contents of a file or lists directory contents.
|
|
1660
|
+
*
|
|
1661
|
+
* **When to use**
|
|
1662
|
+
*
|
|
1663
|
+
* Use when validating or constructing the standalone Anthropic Text Editor
|
|
1664
|
+
* `view` command.
|
|
1104
1665
|
*
|
|
1105
1666
|
* **Details**
|
|
1106
1667
|
*
|
|
1107
1668
|
* When used on a file, returns the file contents, optionally limited to a line
|
|
1108
1669
|
* range. When used on a directory, lists all files and subdirectories.
|
|
1670
|
+
* `view_range` is a 1-indexed `[start, end]` tuple where `-1` means through
|
|
1671
|
+
* the end of the file.
|
|
1672
|
+
*
|
|
1673
|
+
* @see {@link CodeExecutionTextEditorView} for the code-execution variant without `view_range`
|
|
1109
1674
|
*
|
|
1110
|
-
* @category
|
|
1675
|
+
* @category text editor
|
|
1111
1676
|
* @since 4.0.0
|
|
1112
1677
|
*/
|
|
1113
1678
|
export const TextEditorViewCommand = Schema.Struct({
|
|
@@ -1125,7 +1690,12 @@ export const TextEditorViewCommand = Schema.Struct({
|
|
|
1125
1690
|
/**
|
|
1126
1691
|
* Text editor command payload for viewing file contents or listing directory contents.
|
|
1127
1692
|
*
|
|
1128
|
-
*
|
|
1693
|
+
* **Details**
|
|
1694
|
+
*
|
|
1695
|
+
* `view_range` is a 1-indexed `[start, end]` tuple where `-1` means through
|
|
1696
|
+
* the end of the file.
|
|
1697
|
+
*
|
|
1698
|
+
* @category text editor
|
|
1129
1699
|
* @since 4.0.0
|
|
1130
1700
|
*/
|
|
1131
1701
|
export type TextEditorViewCommand = typeof TextEditorViewCommand.Type
|
|
@@ -1133,11 +1703,21 @@ export type TextEditorViewCommand = typeof TextEditorViewCommand.Type
|
|
|
1133
1703
|
/**
|
|
1134
1704
|
* Create a new file with specified content.
|
|
1135
1705
|
*
|
|
1706
|
+
* **When to use**
|
|
1707
|
+
*
|
|
1708
|
+
* Use when validating or constructing an Anthropic text editor `create`
|
|
1709
|
+
* command.
|
|
1710
|
+
*
|
|
1711
|
+
* **Details**
|
|
1712
|
+
*
|
|
1713
|
+
* The payload is discriminated by `command: "create"` and requires both `path`
|
|
1714
|
+
* and `file_text`.
|
|
1715
|
+
*
|
|
1136
1716
|
* **Gotchas**
|
|
1137
1717
|
*
|
|
1138
1718
|
* Fails if the file already exists. Parent directories must exist.
|
|
1139
1719
|
*
|
|
1140
|
-
* @category
|
|
1720
|
+
* @category text editor
|
|
1141
1721
|
* @since 4.0.0
|
|
1142
1722
|
*/
|
|
1143
1723
|
export const TextEditorCreateCommand = Schema.Struct({
|
|
@@ -1158,20 +1738,33 @@ export const TextEditorCreateCommand = Schema.Struct({
|
|
|
1158
1738
|
*
|
|
1159
1739
|
* The command fails if the file already exists or if parent directories are missing.
|
|
1160
1740
|
*
|
|
1161
|
-
* @category
|
|
1741
|
+
* @category text editor
|
|
1162
1742
|
* @since 4.0.0
|
|
1163
1743
|
*/
|
|
1164
1744
|
export type TextEditorCreateCommand = typeof TextEditorCreateCommand.Type
|
|
1165
1745
|
|
|
1166
1746
|
/**
|
|
1167
|
-
*
|
|
1747
|
+
* Replaces a specific string in a file with a new string.
|
|
1748
|
+
*
|
|
1749
|
+
* **When to use**
|
|
1750
|
+
*
|
|
1751
|
+
* Use when validating or constructing standalone Anthropic text editor
|
|
1752
|
+
* `str_replace` commands.
|
|
1753
|
+
*
|
|
1754
|
+
* **Details**
|
|
1755
|
+
*
|
|
1756
|
+
* The payload uses `command: "str_replace"`, `path`, `old_str`, and `new_str`.
|
|
1757
|
+
* `new_str` may be empty to delete text.
|
|
1168
1758
|
*
|
|
1169
1759
|
* **Gotchas**
|
|
1170
1760
|
*
|
|
1171
1761
|
* The `old_str` must match exactly (including whitespace and indentation)
|
|
1172
1762
|
* and must be unique in the file.
|
|
1173
1763
|
*
|
|
1174
|
-
* @
|
|
1764
|
+
* @see {@link TextEditorViewCommand} for reading contents before choosing `old_str`
|
|
1765
|
+
* @see {@link CodeExecutionTextEditorStrReplace} for the code-execution variant
|
|
1766
|
+
*
|
|
1767
|
+
* @category text editor
|
|
1175
1768
|
* @since 4.0.0
|
|
1176
1769
|
*/
|
|
1177
1770
|
export const TextEditorStrReplaceCommand = Schema.Struct({
|
|
@@ -1192,19 +1785,25 @@ export const TextEditorStrReplaceCommand = Schema.Struct({
|
|
|
1192
1785
|
/**
|
|
1193
1786
|
* Text editor command payload for replacing one exact, unique string in a file.
|
|
1194
1787
|
*
|
|
1195
|
-
*
|
|
1788
|
+
* **Gotchas**
|
|
1789
|
+
*
|
|
1790
|
+
* The `old_str` must match exactly, including whitespace and indentation, and
|
|
1791
|
+
* must be unique in the file.
|
|
1792
|
+
*
|
|
1793
|
+
* @category text editor
|
|
1196
1794
|
* @since 4.0.0
|
|
1197
1795
|
*/
|
|
1198
1796
|
export type TextEditorStrReplaceCommand = typeof TextEditorStrReplaceCommand.Type
|
|
1199
1797
|
|
|
1200
1798
|
/**
|
|
1201
|
-
*
|
|
1799
|
+
* Inserts text at a specific line number in a file.
|
|
1202
1800
|
*
|
|
1203
1801
|
* **Details**
|
|
1204
1802
|
*
|
|
1205
|
-
* Inserts the new text
|
|
1803
|
+
* Inserts the new text after the specified line number. Use `0` to insert at
|
|
1804
|
+
* the beginning of the file; other values are 1-indexed.
|
|
1206
1805
|
*
|
|
1207
|
-
* @category
|
|
1806
|
+
* @category text editor
|
|
1208
1807
|
* @since 4.0.0
|
|
1209
1808
|
*/
|
|
1210
1809
|
export const TextEditorInsertCommand = Schema.Struct({
|
|
@@ -1225,24 +1824,26 @@ export const TextEditorInsertCommand = Schema.Struct({
|
|
|
1225
1824
|
/**
|
|
1226
1825
|
* Text editor command payload for inserting text after a specific line number in a file.
|
|
1227
1826
|
*
|
|
1228
|
-
* @category
|
|
1827
|
+
* @category text editor
|
|
1229
1828
|
* @since 4.0.0
|
|
1230
1829
|
*/
|
|
1231
1830
|
export type TextEditorInsertCommand = typeof TextEditorInsertCommand.Type
|
|
1232
1831
|
|
|
1233
1832
|
/**
|
|
1234
|
-
*
|
|
1833
|
+
* Undoes the last edit made to a file.
|
|
1235
1834
|
*
|
|
1236
1835
|
* **Details**
|
|
1237
1836
|
*
|
|
1238
|
-
* Reverts the most recent str_replace
|
|
1837
|
+
* Reverts the most recent `str_replace`, `insert`, or `create` operation on the
|
|
1838
|
+
* file.
|
|
1239
1839
|
*
|
|
1240
1840
|
* **Gotchas**
|
|
1241
1841
|
*
|
|
1242
|
-
* This command is available in text_editor_20241022 and
|
|
1243
|
-
* but not in
|
|
1842
|
+
* This command is available in `text_editor_20241022` and
|
|
1843
|
+
* `text_editor_20250124`, but not in `text_editor_20250429` or
|
|
1844
|
+
* `text_editor_20250728`.
|
|
1244
1845
|
*
|
|
1245
|
-
* @category
|
|
1846
|
+
* @category text editor
|
|
1246
1847
|
* @since 4.0.0
|
|
1247
1848
|
*/
|
|
1248
1849
|
export const TextEditorUndoEditCommand = Schema.Struct({
|
|
@@ -1257,9 +1858,10 @@ export const TextEditorUndoEditCommand = Schema.Struct({
|
|
|
1257
1858
|
*
|
|
1258
1859
|
* **Gotchas**
|
|
1259
1860
|
*
|
|
1260
|
-
* Available for `text_editor_20241022` and `text_editor_20250124`, but not for
|
|
1861
|
+
* Available for `text_editor_20241022` and `text_editor_20250124`, but not for
|
|
1862
|
+
* `text_editor_20250429` or `text_editor_20250728`.
|
|
1261
1863
|
*
|
|
1262
|
-
* @category
|
|
1864
|
+
* @category text editor
|
|
1263
1865
|
* @since 4.0.0
|
|
1264
1866
|
*/
|
|
1265
1867
|
export type TextEditorUndoEditCommand = typeof TextEditorUndoEditCommand.Type
|
|
@@ -1296,13 +1898,22 @@ const TextEditor_StrReplaceBasedEdit_Args = Schema.Struct({
|
|
|
1296
1898
|
// -----------------------------------------------------------------------------
|
|
1297
1899
|
|
|
1298
1900
|
/**
|
|
1299
|
-
*
|
|
1901
|
+
* Defines the deprecated text editor tool for Claude 3.5 Sonnet.
|
|
1902
|
+
*
|
|
1903
|
+
* **When to use**
|
|
1904
|
+
*
|
|
1905
|
+
* Use when configuring the 2024-10-22 `str_replace_editor` compatibility path
|
|
1906
|
+
* for Claude 3.5 Sonnet.
|
|
1300
1907
|
*
|
|
1301
1908
|
* **Details**
|
|
1302
1909
|
*
|
|
1303
|
-
* Requires the "computer-use-2024-10-22" beta header
|
|
1910
|
+
* Requires the "computer-use-2024-10-22" beta header and supports `view`,
|
|
1911
|
+
* `create`, `str_replace`, `insert`, and `undo_edit` commands.
|
|
1912
|
+
*
|
|
1913
|
+
* @see {@link TextEditor_20250124} for the newer `str_replace_editor` version
|
|
1914
|
+
* @see {@link TextEditor_20250728} for the Claude 4 `str_replace_based_edit_tool` line
|
|
1304
1915
|
*
|
|
1305
|
-
* @category
|
|
1916
|
+
* @category text editor
|
|
1306
1917
|
* @since 4.0.0
|
|
1307
1918
|
*/
|
|
1308
1919
|
export const TextEditor_20241022 = Tool.providerDefined({
|
|
@@ -1315,13 +1926,22 @@ export const TextEditor_20241022 = Tool.providerDefined({
|
|
|
1315
1926
|
})
|
|
1316
1927
|
|
|
1317
1928
|
/**
|
|
1318
|
-
*
|
|
1929
|
+
* Defines the text editor tool for deprecated Claude Sonnet 3.7.
|
|
1930
|
+
*
|
|
1931
|
+
* **When to use**
|
|
1932
|
+
*
|
|
1933
|
+
* Use when configuring the 2025-01-24 Claude Sonnet 3.7 text editor tool using
|
|
1934
|
+
* `str_replace_editor`.
|
|
1319
1935
|
*
|
|
1320
1936
|
* **Details**
|
|
1321
1937
|
*
|
|
1322
|
-
* Requires the "computer-use-2025-01-24" beta header
|
|
1938
|
+
* Requires the "computer-use-2025-01-24" beta header, requires a handler, and
|
|
1939
|
+
* supports `view`, `create`, `str_replace`, `insert`, and `undo_edit` commands.
|
|
1940
|
+
*
|
|
1941
|
+
* @see {@link TextEditor_20241022} for the older `str_replace_editor` version
|
|
1942
|
+
* @see {@link TextEditor_20250429} for the Claude 4 `str_replace_based_edit_tool` line
|
|
1323
1943
|
*
|
|
1324
|
-
* @category
|
|
1944
|
+
* @category text editor
|
|
1325
1945
|
* @since 4.0.0
|
|
1326
1946
|
*/
|
|
1327
1947
|
export const TextEditor_20250124 = Tool.providerDefined({
|
|
@@ -1334,7 +1954,12 @@ export const TextEditor_20250124 = Tool.providerDefined({
|
|
|
1334
1954
|
})
|
|
1335
1955
|
|
|
1336
1956
|
/**
|
|
1337
|
-
*
|
|
1957
|
+
* Defines the text editor tool for Claude 4 models using Anthropic's `str_replace_based_edit_tool`.
|
|
1958
|
+
*
|
|
1959
|
+
* **When to use**
|
|
1960
|
+
*
|
|
1961
|
+
* Use when configuring the 2025-04-29 Claude 4 `str_replace_based_edit_tool`
|
|
1962
|
+
* version.
|
|
1338
1963
|
*
|
|
1339
1964
|
* **Details**
|
|
1340
1965
|
*
|
|
@@ -1344,7 +1969,10 @@ export const TextEditor_20250124 = Tool.providerDefined({
|
|
|
1344
1969
|
*
|
|
1345
1970
|
* This version does not support the `undo_edit` command.
|
|
1346
1971
|
*
|
|
1347
|
-
* @
|
|
1972
|
+
* @see {@link TextEditor_20250124} for the previous `str_replace_editor` version
|
|
1973
|
+
* @see {@link TextEditor_20250728} for the later Claude 4 text editor version
|
|
1974
|
+
*
|
|
1975
|
+
* @category text editor
|
|
1348
1976
|
* @since 4.0.0
|
|
1349
1977
|
*/
|
|
1350
1978
|
export const TextEditor_20250429 = Tool.providerDefined({
|
|
@@ -1358,13 +1986,18 @@ export const TextEditor_20250429 = Tool.providerDefined({
|
|
|
1358
1986
|
})
|
|
1359
1987
|
|
|
1360
1988
|
/**
|
|
1361
|
-
*
|
|
1989
|
+
* Defines the text editor tool for Claude 4 models.
|
|
1990
|
+
*
|
|
1991
|
+
* **Details**
|
|
1992
|
+
*
|
|
1993
|
+
* Uses Anthropic's `str_replace_based_edit_tool`. `max_characters` can limit
|
|
1994
|
+
* file-view output for this version.
|
|
1362
1995
|
*
|
|
1363
1996
|
* **Gotchas**
|
|
1364
1997
|
*
|
|
1365
1998
|
* This version does not support the `undo_edit` command.
|
|
1366
1999
|
*
|
|
1367
|
-
* @category
|
|
2000
|
+
* @category text editor
|
|
1368
2001
|
* @since 4.0.0
|
|
1369
2002
|
*/
|
|
1370
2003
|
export const TextEditor_20250728 = Tool.providerDefined({
|
|
@@ -1386,12 +2019,20 @@ export const TextEditor_20250728 = Tool.providerDefined({
|
|
|
1386
2019
|
// -----------------------------------------------------------------------------
|
|
1387
2020
|
|
|
1388
2021
|
/**
|
|
1389
|
-
*
|
|
2022
|
+
* Describes user location for localizing search results.
|
|
1390
2023
|
*
|
|
1391
2024
|
* **When to use**
|
|
1392
2025
|
*
|
|
1393
|
-
*
|
|
1394
|
-
* queries like weather, local businesses, events
|
|
2026
|
+
* Use when providing location helps return more relevant results for
|
|
2027
|
+
* location-dependent queries like weather, local businesses, or events.
|
|
2028
|
+
*
|
|
2029
|
+
* **Details**
|
|
2030
|
+
*
|
|
2031
|
+
* The schema uses `type: "approximate"` plus optional `city`, `region`,
|
|
2032
|
+
* `country`, and `timezone`. `country` is an ISO 3166-1 alpha-2 code, and
|
|
2033
|
+
* `timezone` is an IANA time zone identifier.
|
|
2034
|
+
*
|
|
2035
|
+
* @see {@link WebSearch_20250305_Args} for the argument schema that consumes this location
|
|
1395
2036
|
*
|
|
1396
2037
|
* @category Web Search
|
|
1397
2038
|
* @since 4.0.0
|
|
@@ -1424,7 +2065,24 @@ export const WebSearchUserLocation = Schema.Struct({
|
|
|
1424
2065
|
// -----------------------------------------------------------------------------
|
|
1425
2066
|
|
|
1426
2067
|
/**
|
|
1427
|
-
*
|
|
2068
|
+
* Defines configuration arguments for the web search tool.
|
|
2069
|
+
*
|
|
2070
|
+
* **When to use**
|
|
2071
|
+
*
|
|
2072
|
+
* Use when configuring `WebSearch_20250305` with search limits, domain filters,
|
|
2073
|
+
* or user location.
|
|
2074
|
+
*
|
|
2075
|
+
* **Details**
|
|
2076
|
+
*
|
|
2077
|
+
* The payload can set `maxUses`, `allowedDomains`, `blockedDomains`, and
|
|
2078
|
+
* `userLocation`.
|
|
2079
|
+
*
|
|
2080
|
+
* **Gotchas**
|
|
2081
|
+
*
|
|
2082
|
+
* `allowedDomains` and `blockedDomains` are mutually exclusive.
|
|
2083
|
+
*
|
|
2084
|
+
* @see {@link WebSearch_20250305} for the provider-defined tool that consumes these arguments
|
|
2085
|
+
* @see {@link WebSearchUserLocation} for localizing search results
|
|
1428
2086
|
*
|
|
1429
2087
|
* @category Web Search
|
|
1430
2088
|
* @since 4.0.0
|
|
@@ -1454,6 +2112,10 @@ export const WebSearch_20250305_Args = Schema.Struct({
|
|
|
1454
2112
|
/**
|
|
1455
2113
|
* Configuration arguments for the Anthropic web search tool, including usage limits, domain filters, and optional user location.
|
|
1456
2114
|
*
|
|
2115
|
+
* **Gotchas**
|
|
2116
|
+
*
|
|
2117
|
+
* `allowedDomains` and `blockedDomains` are mutually exclusive.
|
|
2118
|
+
*
|
|
1457
2119
|
* @category Web Search
|
|
1458
2120
|
* @since 4.0.0
|
|
1459
2121
|
*/
|
|
@@ -1464,7 +2126,14 @@ export type WebSearch_20250305_Args = typeof WebSearch_20250305_Args.Type
|
|
|
1464
2126
|
// -----------------------------------------------------------------------------
|
|
1465
2127
|
|
|
1466
2128
|
/**
|
|
1467
|
-
*
|
|
2129
|
+
* Schema for Claude-supplied web search tool parameters.
|
|
2130
|
+
*
|
|
2131
|
+
* **Details**
|
|
2132
|
+
*
|
|
2133
|
+
* The payload contains the generated `query` string and is consumed by
|
|
2134
|
+
* `WebSearch_20250305`.
|
|
2135
|
+
*
|
|
2136
|
+
* @see {@link WebSearch_20250305} for the provider-defined tool that consumes this payload
|
|
1468
2137
|
*
|
|
1469
2138
|
* @category Web Search
|
|
1470
2139
|
* @since 4.0.0
|
|
@@ -1482,6 +2151,8 @@ export const WebSearchParameters = Schema.Struct({
|
|
|
1482
2151
|
*
|
|
1483
2152
|
* Contains the generated search query used by `WebSearch_20250305`.
|
|
1484
2153
|
*
|
|
2154
|
+
* @see {@link WebSearch_20250305} for the provider-defined tool that consumes this payload
|
|
2155
|
+
*
|
|
1485
2156
|
* @category Web Search
|
|
1486
2157
|
* @since 4.0.0
|
|
1487
2158
|
*/
|
|
@@ -1492,7 +2163,11 @@ export type WebSearchParameters = typeof WebSearchParameters.Type
|
|
|
1492
2163
|
// -----------------------------------------------------------------------------
|
|
1493
2164
|
|
|
1494
2165
|
/**
|
|
1495
|
-
*
|
|
2166
|
+
* Defines the web search tool for Claude models.
|
|
2167
|
+
*
|
|
2168
|
+
* **When to use**
|
|
2169
|
+
*
|
|
2170
|
+
* Use when Claude should search the web for real-time information.
|
|
1496
2171
|
*
|
|
1497
2172
|
* **Details**
|
|
1498
2173
|
*
|
|
@@ -1500,6 +2175,8 @@ export type WebSearchParameters = typeof WebSearchParameters.Type
|
|
|
1500
2175
|
* server-side tool executed by Anthropic's infrastructure.
|
|
1501
2176
|
* Generally available (no beta header required).
|
|
1502
2177
|
*
|
|
2178
|
+
* @see {@link WebFetch_20250910} for retrieving known URLs after discovery
|
|
2179
|
+
*
|
|
1503
2180
|
* @category Web Search
|
|
1504
2181
|
* @since 4.0.0
|
|
1505
2182
|
*/
|
|
@@ -1522,7 +2199,18 @@ export const WebSearch_20250305 = Tool.providerDefined({
|
|
|
1522
2199
|
// -----------------------------------------------------------------------------
|
|
1523
2200
|
|
|
1524
2201
|
/**
|
|
1525
|
-
*
|
|
2202
|
+
* Defines citation configuration for web fetch.
|
|
2203
|
+
*
|
|
2204
|
+
* **When to use**
|
|
2205
|
+
*
|
|
2206
|
+
* Use when configuring whether web fetch results should include citations.
|
|
2207
|
+
*
|
|
2208
|
+
* **Details**
|
|
2209
|
+
*
|
|
2210
|
+
* The payload contains the `enabled` flag. `citations` is optional on
|
|
2211
|
+
* `WebFetch_20250910_Args`, and citations are disabled by default.
|
|
2212
|
+
*
|
|
2213
|
+
* @see {@link WebFetch_20250910_Args} for the argument schema that consumes this configuration
|
|
1526
2214
|
*
|
|
1527
2215
|
* @category Web Fetch
|
|
1528
2216
|
* @since 4.0.0
|
|
@@ -1536,6 +2224,13 @@ export const WebFetchCitationsConfig = Schema.Struct({
|
|
|
1536
2224
|
/**
|
|
1537
2225
|
* Configuration payload for enabling or disabling citations on web fetch results.
|
|
1538
2226
|
*
|
|
2227
|
+
* **Details**
|
|
2228
|
+
*
|
|
2229
|
+
* The payload contains the `enabled` flag. `citations` is optional on
|
|
2230
|
+
* `WebFetch_20250910_Args`, and citations are disabled by default.
|
|
2231
|
+
*
|
|
2232
|
+
* @see {@link WebFetch_20250910_Args} for the argument schema that consumes this configuration
|
|
2233
|
+
*
|
|
1539
2234
|
* @category Web Fetch
|
|
1540
2235
|
* @since 4.0.0
|
|
1541
2236
|
*/
|
|
@@ -1546,7 +2241,26 @@ export type WebFetchCitationsConfig = typeof WebFetchCitationsConfig.Type
|
|
|
1546
2241
|
// -----------------------------------------------------------------------------
|
|
1547
2242
|
|
|
1548
2243
|
/**
|
|
1549
|
-
*
|
|
2244
|
+
* Defines configuration arguments for the web fetch tool.
|
|
2245
|
+
*
|
|
2246
|
+
* **When to use**
|
|
2247
|
+
*
|
|
2248
|
+
* Use when configuring `WebFetch_20250910` with usage limits, domain filters,
|
|
2249
|
+
* citations, or content token limits.
|
|
2250
|
+
*
|
|
2251
|
+
* **Details**
|
|
2252
|
+
*
|
|
2253
|
+
* The payload can set `maxUses`, domain filters, `citations`, and
|
|
2254
|
+
* `maxContentTokens`, which map to Anthropic web fetch request fields.
|
|
2255
|
+
*
|
|
2256
|
+
* **Gotchas**
|
|
2257
|
+
*
|
|
2258
|
+
* `allowedDomains` and `blockedDomains` are mutually exclusive.
|
|
2259
|
+
* `maxContentTokens` is approximate and does not apply to binary content such
|
|
2260
|
+
* as PDFs.
|
|
2261
|
+
*
|
|
2262
|
+
* @see {@link WebFetch_20250910} for the provider-defined tool that consumes these arguments
|
|
2263
|
+
* @see {@link WebFetchCitationsConfig} for configuring citations
|
|
1550
2264
|
*
|
|
1551
2265
|
* @category Web Fetch
|
|
1552
2266
|
* @since 4.0.0
|
|
@@ -1580,6 +2294,12 @@ export const WebFetch_20250910_Args = Schema.Struct({
|
|
|
1580
2294
|
/**
|
|
1581
2295
|
* Configuration arguments for the Anthropic web fetch tool, including usage limits, domain filters, citation settings, and token limits.
|
|
1582
2296
|
*
|
|
2297
|
+
* **Gotchas**
|
|
2298
|
+
*
|
|
2299
|
+
* `allowedDomains` and `blockedDomains` are mutually exclusive.
|
|
2300
|
+
* `maxContentTokens` is approximate and does not apply to binary content such
|
|
2301
|
+
* as PDFs.
|
|
2302
|
+
*
|
|
1583
2303
|
* @category Web Fetch
|
|
1584
2304
|
* @since 4.0.0
|
|
1585
2305
|
*/
|
|
@@ -1590,7 +2310,23 @@ export type WebFetch_20250910_Args = typeof WebFetch_20250910_Args.Type
|
|
|
1590
2310
|
// -----------------------------------------------------------------------------
|
|
1591
2311
|
|
|
1592
2312
|
/**
|
|
1593
|
-
*
|
|
2313
|
+
* Schema for Claude-supplied web fetch parameters.
|
|
2314
|
+
*
|
|
2315
|
+
* **When to use**
|
|
2316
|
+
*
|
|
2317
|
+
* Use when validating or constructing the `url` payload consumed by
|
|
2318
|
+
* `WebFetch_20250910`.
|
|
2319
|
+
*
|
|
2320
|
+
* **Details**
|
|
2321
|
+
*
|
|
2322
|
+
* The payload contains the single `url` parameter for Anthropic web fetch.
|
|
2323
|
+
*
|
|
2324
|
+
* **Gotchas**
|
|
2325
|
+
*
|
|
2326
|
+
* The URL must be user-provided or from prior search/fetch results. Maximum URL
|
|
2327
|
+
* length is 250 characters.
|
|
2328
|
+
*
|
|
2329
|
+
* @see {@link WebFetch_20250910} for the provider-defined tool that consumes this payload
|
|
1594
2330
|
*
|
|
1595
2331
|
* @category Web Fetch
|
|
1596
2332
|
* @since 4.0.0
|
|
@@ -1605,6 +2341,15 @@ export const WebFetchParameters = Schema.Struct({
|
|
|
1605
2341
|
/**
|
|
1606
2342
|
* Type of the parameters Claude supplies when invoking the Anthropic web fetch tool.
|
|
1607
2343
|
*
|
|
2344
|
+
* **Details**
|
|
2345
|
+
*
|
|
2346
|
+
* The payload contains the single `url` parameter for Anthropic web fetch.
|
|
2347
|
+
*
|
|
2348
|
+
* **Gotchas**
|
|
2349
|
+
*
|
|
2350
|
+
* The URL must be user-provided or from prior search/fetch results. Maximum URL
|
|
2351
|
+
* length is 250 characters.
|
|
2352
|
+
*
|
|
1608
2353
|
* @category Web Fetch
|
|
1609
2354
|
* @since 4.0.0
|
|
1610
2355
|
*/
|
|
@@ -1615,13 +2360,19 @@ export type WebFetchParameters = typeof WebFetchParameters.Type
|
|
|
1615
2360
|
// -----------------------------------------------------------------------------
|
|
1616
2361
|
|
|
1617
2362
|
/**
|
|
1618
|
-
*
|
|
2363
|
+
* Defines the web fetch tool for Claude models.
|
|
2364
|
+
*
|
|
2365
|
+
* **When to use**
|
|
2366
|
+
*
|
|
2367
|
+
* Use when Claude should retrieve the content of a specific web page or PDF.
|
|
1619
2368
|
*
|
|
1620
2369
|
* **Details**
|
|
1621
2370
|
*
|
|
1622
2371
|
* Allows Claude to retrieve full content from web pages and PDF documents.
|
|
1623
|
-
* This is a server-side tool executed by Anthropic's infrastructure.
|
|
1624
|
-
*
|
|
2372
|
+
* This is a server-side tool executed by Anthropic's infrastructure. Selecting
|
|
2373
|
+
* this tool adds the "web-fetch-2025-09-10" beta header.
|
|
2374
|
+
*
|
|
2375
|
+
* @see {@link WebSearch_20250305} for discovering URLs before fetching specific content
|
|
1625
2376
|
*
|
|
1626
2377
|
* @category Web Fetch
|
|
1627
2378
|
* @since 4.0.0
|
|
@@ -1645,14 +2396,14 @@ export const WebFetch_20250910 = Tool.providerDefined({
|
|
|
1645
2396
|
// -----------------------------------------------------------------------------
|
|
1646
2397
|
|
|
1647
2398
|
/**
|
|
1648
|
-
*
|
|
2399
|
+
* Schema for regex-based tool search input parameters.
|
|
1649
2400
|
*
|
|
1650
2401
|
* **Details**
|
|
1651
2402
|
*
|
|
1652
2403
|
* Claude constructs regex patterns using Python's `re.search()` syntax.
|
|
1653
2404
|
* Maximum query length: 200 characters.
|
|
1654
2405
|
*
|
|
1655
|
-
* @category
|
|
2406
|
+
* @category tool search
|
|
1656
2407
|
* @since 4.0.0
|
|
1657
2408
|
*/
|
|
1658
2409
|
export const ToolSearchRegexParameters = Schema.Struct({
|
|
@@ -1664,15 +2415,32 @@ export const ToolSearchRegexParameters = Schema.Struct({
|
|
|
1664
2415
|
/**
|
|
1665
2416
|
* Type of the parameters Claude supplies when invoking regex-based Anthropic tool search.
|
|
1666
2417
|
*
|
|
1667
|
-
*
|
|
2418
|
+
* **Details**
|
|
2419
|
+
*
|
|
2420
|
+
* Claude constructs regex patterns using Python's `re.search()` syntax.
|
|
2421
|
+
* Maximum query length: 200 characters.
|
|
2422
|
+
*
|
|
2423
|
+
* @category tool search
|
|
1668
2424
|
* @since 4.0.0
|
|
1669
2425
|
*/
|
|
1670
2426
|
export type ToolSearchRegexParameters = typeof ToolSearchRegexParameters.Type
|
|
1671
2427
|
|
|
1672
2428
|
/**
|
|
1673
|
-
*
|
|
2429
|
+
* Defines input parameters for BM25/natural language tool search.
|
|
2430
|
+
*
|
|
2431
|
+
* **When to use**
|
|
2432
|
+
*
|
|
2433
|
+
* Use when validating or constructing the natural-language query payload for
|
|
2434
|
+
* `ToolSearchBM25_20251119`.
|
|
2435
|
+
*
|
|
2436
|
+
* **Details**
|
|
1674
2437
|
*
|
|
1675
|
-
*
|
|
2438
|
+
* The payload contains Claude's natural-language `query`. BM25 searches tool
|
|
2439
|
+
* names, descriptions, argument names, and argument descriptions.
|
|
2440
|
+
*
|
|
2441
|
+
* @see {@link ToolSearchBM25_20251119} for the provider-defined tool that consumes these parameters
|
|
2442
|
+
*
|
|
2443
|
+
* @category tool search
|
|
1676
2444
|
* @since 4.0.0
|
|
1677
2445
|
*/
|
|
1678
2446
|
export const ToolSearchBM25Parameters = Schema.Struct({
|
|
@@ -1684,7 +2452,7 @@ export const ToolSearchBM25Parameters = Schema.Struct({
|
|
|
1684
2452
|
/**
|
|
1685
2453
|
* Type of the parameters Claude supplies when invoking BM25 natural-language Anthropic tool search.
|
|
1686
2454
|
*
|
|
1687
|
-
* @category
|
|
2455
|
+
* @category tool search
|
|
1688
2456
|
* @since 4.0.0
|
|
1689
2457
|
*/
|
|
1690
2458
|
export type ToolSearchBM25Parameters = typeof ToolSearchBM25Parameters.Type
|
|
@@ -1694,7 +2462,7 @@ export type ToolSearchBM25Parameters = typeof ToolSearchBM25Parameters.Type
|
|
|
1694
2462
|
// -----------------------------------------------------------------------------
|
|
1695
2463
|
|
|
1696
2464
|
/**
|
|
1697
|
-
*
|
|
2465
|
+
* Defines regex-based tool search for Claude models.
|
|
1698
2466
|
*
|
|
1699
2467
|
* **Details**
|
|
1700
2468
|
*
|
|
@@ -1703,7 +2471,7 @@ export type ToolSearchBM25Parameters = typeof ToolSearchBM25Parameters.Type
|
|
|
1703
2471
|
* argument names, and argument descriptions.
|
|
1704
2472
|
* Requires the "advanced-tool-use-2025-11-20" beta header.
|
|
1705
2473
|
*
|
|
1706
|
-
* @category
|
|
2474
|
+
* @category tool search
|
|
1707
2475
|
* @since 4.0.0
|
|
1708
2476
|
*/
|
|
1709
2477
|
export const ToolSearchRegex_20251119 = Tool.providerDefined({
|
|
@@ -1716,7 +2484,12 @@ export const ToolSearchRegex_20251119 = Tool.providerDefined({
|
|
|
1716
2484
|
})
|
|
1717
2485
|
|
|
1718
2486
|
/**
|
|
1719
|
-
* BM25/natural language tool search for Claude models.
|
|
2487
|
+
* Defines BM25/natural language tool search for Claude models.
|
|
2488
|
+
*
|
|
2489
|
+
* **When to use**
|
|
2490
|
+
*
|
|
2491
|
+
* Use when you want Claude to find relevant tools from a natural-language query
|
|
2492
|
+
* instead of a regex pattern.
|
|
1720
2493
|
*
|
|
1721
2494
|
* **Details**
|
|
1722
2495
|
*
|
|
@@ -1725,7 +2498,9 @@ export const ToolSearchRegex_20251119 = Tool.providerDefined({
|
|
|
1725
2498
|
* argument names, and argument descriptions.
|
|
1726
2499
|
* Requires the "advanced-tool-use-2025-11-20" beta header.
|
|
1727
2500
|
*
|
|
1728
|
-
* @
|
|
2501
|
+
* @see {@link ToolSearchRegex_20251119} for the regex-pattern alternative
|
|
2502
|
+
*
|
|
2503
|
+
* @category tool search
|
|
1729
2504
|
* @since 4.0.0
|
|
1730
2505
|
*/
|
|
1731
2506
|
export const ToolSearchBM25_20251119 = Tool.providerDefined({
|