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