@effect/ai-anthropic 4.0.0-beta.8 → 4.0.0-beta.81
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 +93 -74
- package/dist/AnthropicClient.d.ts.map +1 -1
- package/dist/AnthropicClient.js +51 -19
- package/dist/AnthropicClient.js.map +1 -1
- package/dist/AnthropicConfig.d.ts +55 -10
- package/dist/AnthropicConfig.d.ts.map +1 -1
- package/dist/AnthropicConfig.js +30 -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 +362 -52
- package/dist/AnthropicLanguageModel.d.ts.map +1 -1
- package/dist/AnthropicLanguageModel.js +88 -21
- package/dist/AnthropicLanguageModel.js.map +1 -1
- package/dist/AnthropicTelemetry.d.ts +43 -16
- package/dist/AnthropicTelemetry.d.ts.map +1 -1
- package/dist/AnthropicTelemetry.js +15 -9
- package/dist/AnthropicTelemetry.js.map +1 -1
- package/dist/AnthropicTool.d.ts +1223 -289
- package/dist/AnthropicTool.d.ts.map +1 -1
- package/dist/AnthropicTool.js +859 -201
- package/dist/AnthropicTool.js.map +1 -1
- package/dist/Generated.d.ts +1 -1
- package/dist/Generated.js +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 +114 -104
- package/src/AnthropicConfig.ts +56 -11
- package/src/AnthropicError.ts +138 -37
- package/src/AnthropicLanguageModel.ts +395 -43
- package/src/AnthropicTelemetry.ts +48 -22
- package/src/AnthropicTool.ts +1216 -282
- package/src/Generated.ts +1 -1
- package/src/index.ts +8 -29
- package/src/internal/errors.ts +9 -7
package/dist/AnthropicTool.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Anthropic provider
|
|
2
|
+
* The `AnthropicTool` module defines Anthropic provider tools and the schemas
|
|
3
|
+
* for their inputs and results. It covers Anthropic-owned tools such as Bash,
|
|
4
|
+
* Code Execution, Computer Use, Memory, Text Editor, Web Search, Web Fetch, and
|
|
5
|
+
* Tool Search, which can be attached to Anthropic-backed Effect AI language
|
|
6
|
+
* model requests.
|
|
3
7
|
*
|
|
4
|
-
*
|
|
5
|
-
* Bash, Code Execution, Computer Use, Memory, and Text Editor functionality.
|
|
6
|
-
*
|
|
7
|
-
* @since 1.0.0
|
|
8
|
+
* @since 4.0.0
|
|
8
9
|
*/
|
|
9
10
|
import * as Schema from "effect/Schema";
|
|
10
11
|
import * as Tool from "effect/unstable/ai/Tool";
|
|
@@ -13,13 +14,22 @@ import * as Generated from "./Generated.js";
|
|
|
13
14
|
// Bash
|
|
14
15
|
// =============================================================================
|
|
15
16
|
/**
|
|
16
|
-
* Anthropic Bash tool (2024-10-22 version).
|
|
17
|
+
* Defines the Anthropic Bash tool (2024-10-22 version).
|
|
18
|
+
*
|
|
19
|
+
* **When to use**
|
|
20
|
+
*
|
|
21
|
+
* Use when you want the model to execute bash commands with the 2024-10-22
|
|
22
|
+
* Anthropic computer-use beta.
|
|
23
|
+
*
|
|
24
|
+
* **Details**
|
|
17
25
|
*
|
|
18
26
|
* Allows the model to execute bash commands in a sandboxed environment.
|
|
19
27
|
* Requires the "computer-use-2024-10-22" beta header.
|
|
20
28
|
*
|
|
21
|
-
* @
|
|
29
|
+
* @see {@link Bash_20250124} for the newer 2025-01-24 version of the bash tool
|
|
30
|
+
*
|
|
22
31
|
* @category Bash
|
|
32
|
+
* @since 4.0.0
|
|
23
33
|
*/
|
|
24
34
|
export const Bash_20241022 = /*#__PURE__*/Tool.providerDefined({
|
|
25
35
|
id: "anthropic.bash_20241022",
|
|
@@ -33,13 +43,22 @@ export const Bash_20241022 = /*#__PURE__*/Tool.providerDefined({
|
|
|
33
43
|
})
|
|
34
44
|
});
|
|
35
45
|
/**
|
|
36
|
-
* Anthropic Bash tool (2025-01-24 version).
|
|
46
|
+
* Defines the Anthropic Bash tool (2025-01-24 version).
|
|
47
|
+
*
|
|
48
|
+
* **When to use**
|
|
49
|
+
*
|
|
50
|
+
* Use when you want the model to execute bash commands with the 2025-01-24
|
|
51
|
+
* Anthropic computer-use beta.
|
|
52
|
+
*
|
|
53
|
+
* **Details**
|
|
37
54
|
*
|
|
38
55
|
* Allows the model to execute bash commands in a sandboxed environment.
|
|
39
56
|
* Requires the "computer-use-2025-01-24" beta header.
|
|
40
57
|
*
|
|
41
|
-
* @
|
|
58
|
+
* @see {@link Bash_20241022} for the older 2024-10-22 version of the bash tool
|
|
59
|
+
*
|
|
42
60
|
* @category Bash
|
|
61
|
+
* @since 4.0.0
|
|
43
62
|
*/
|
|
44
63
|
export const Bash_20250124 = /*#__PURE__*/Tool.providerDefined({
|
|
45
64
|
id: "anthropic.bash_20250124",
|
|
@@ -59,10 +78,17 @@ export const Bash_20250124 = /*#__PURE__*/Tool.providerDefined({
|
|
|
59
78
|
// Code Execution 20250522 Parameters
|
|
60
79
|
// -----------------------------------------------------------------------------
|
|
61
80
|
/**
|
|
62
|
-
*
|
|
81
|
+
* Schema for a code execution request that asks Anthropic to run source code as a programmatic tool call.
|
|
82
|
+
*
|
|
83
|
+
* **When to use**
|
|
84
|
+
*
|
|
85
|
+
* Use when constructing or validating a programmatic tool call for the Anthropic
|
|
86
|
+
* Code Execution tool.
|
|
87
|
+
*
|
|
88
|
+
* @see {@link CodeExecution_20250522} for the parent tool definition
|
|
63
89
|
*
|
|
64
|
-
* @since 1.0.0
|
|
65
90
|
* @category Code Execution
|
|
91
|
+
* @since 4.0.0
|
|
66
92
|
*/
|
|
67
93
|
export const CodeExecutionProgrammaticToolCall = /*#__PURE__*/Schema.Struct({
|
|
68
94
|
type: /*#__PURE__*/Schema.Literal("programmatic-tool-call"),
|
|
@@ -72,10 +98,22 @@ export const CodeExecutionProgrammaticToolCall = /*#__PURE__*/Schema.Struct({
|
|
|
72
98
|
code: Schema.String
|
|
73
99
|
});
|
|
74
100
|
/**
|
|
75
|
-
*
|
|
101
|
+
* Schema for the `bash_code_execution` input variant of Anthropic Code Execution.
|
|
102
|
+
*
|
|
103
|
+
* **When to use**
|
|
104
|
+
*
|
|
105
|
+
* Use when validating or constructing a bash command request for
|
|
106
|
+
* `CodeExecution_20250522`.
|
|
107
|
+
*
|
|
108
|
+
* **Details**
|
|
109
|
+
*
|
|
110
|
+
* The schema requires `type` to be `"bash_code_execution"` and `command` to
|
|
111
|
+
* contain the bash command sent to Anthropic.
|
|
112
|
+
*
|
|
113
|
+
* @see {@link CodeExecution_20250522} for the provider-defined tool that consumes this input variant
|
|
76
114
|
*
|
|
77
|
-
* @since 1.0.0
|
|
78
115
|
* @category Code Execution
|
|
116
|
+
* @since 4.0.0
|
|
79
117
|
*/
|
|
80
118
|
export const CodeExecutionBashCommand = /*#__PURE__*/Schema.Struct({
|
|
81
119
|
type: /*#__PURE__*/Schema.Literal("bash_code_execution"),
|
|
@@ -85,10 +123,23 @@ export const CodeExecutionBashCommand = /*#__PURE__*/Schema.Struct({
|
|
|
85
123
|
command: Schema.String
|
|
86
124
|
});
|
|
87
125
|
/**
|
|
88
|
-
*
|
|
126
|
+
* Schema for a code execution text editor request that views a file by path.
|
|
127
|
+
*
|
|
128
|
+
* **When to use**
|
|
129
|
+
*
|
|
130
|
+
* Use when you need the schema for provider-bound code-execution view requests
|
|
131
|
+
* before distinguishing them from create or replace text-editor commands.
|
|
132
|
+
*
|
|
133
|
+
* **Details**
|
|
134
|
+
*
|
|
135
|
+
* The encoded payload uses `type: "text_editor_code_execution"`,
|
|
136
|
+
* `command: "view"`, and a `path` string.
|
|
137
|
+
*
|
|
138
|
+
* @see {@link CodeExecutionTextEditorCreate} for the command that creates a file
|
|
139
|
+
* @see {@link CodeExecutionTextEditorStrReplace} for the command that replaces text in a file
|
|
89
140
|
*
|
|
90
|
-
* @since 1.0.0
|
|
91
141
|
* @category Code Execution
|
|
142
|
+
* @since 4.0.0
|
|
92
143
|
*/
|
|
93
144
|
export const CodeExecutionTextEditorView = /*#__PURE__*/Schema.Struct({
|
|
94
145
|
type: /*#__PURE__*/Schema.Literal("text_editor_code_execution"),
|
|
@@ -99,10 +150,25 @@ export const CodeExecutionTextEditorView = /*#__PURE__*/Schema.Struct({
|
|
|
99
150
|
path: Schema.String
|
|
100
151
|
});
|
|
101
152
|
/**
|
|
102
|
-
*
|
|
153
|
+
* Schema for a text editor code execution request that creates a file at a path.
|
|
154
|
+
*
|
|
155
|
+
* **When to use**
|
|
156
|
+
*
|
|
157
|
+
* Use when validating or constructing an Anthropic `text_editor_code_execution`
|
|
158
|
+
* tool call that should create a file.
|
|
159
|
+
*
|
|
160
|
+
* **Details**
|
|
161
|
+
*
|
|
162
|
+
* The request is discriminated by `type: "text_editor_code_execution"` and
|
|
163
|
+
* `command: "create"`. It requires `path` and accepts optional `file_text`; the
|
|
164
|
+
* schema allows `file_text` to be omitted, `null`, or a string.
|
|
165
|
+
*
|
|
166
|
+
* @see {@link CodeExecution_20250522} for the provider-defined tool that consumes this request
|
|
167
|
+
* @see {@link CodeExecutionTextEditorView} for the matching view request
|
|
168
|
+
* @see {@link CodeExecutionTextEditorStrReplace} for the matching replace request
|
|
103
169
|
*
|
|
104
|
-
* @since 1.0.0
|
|
105
170
|
* @category Code Execution
|
|
171
|
+
* @since 4.0.0
|
|
106
172
|
*/
|
|
107
173
|
export const CodeExecutionTextEditorCreate = /*#__PURE__*/Schema.Struct({
|
|
108
174
|
type: /*#__PURE__*/Schema.Literal("text_editor_code_execution"),
|
|
@@ -117,10 +183,23 @@ export const CodeExecutionTextEditorCreate = /*#__PURE__*/Schema.Struct({
|
|
|
117
183
|
file_text: /*#__PURE__*/Schema.optional(/*#__PURE__*/Schema.NullOr(Schema.String))
|
|
118
184
|
});
|
|
119
185
|
/**
|
|
120
|
-
*
|
|
186
|
+
* Schema for a code execution text editor request that replaces one exact string in a file.
|
|
187
|
+
*
|
|
188
|
+
* **When to use**
|
|
189
|
+
*
|
|
190
|
+
* Use when validating or constructing the `str_replace` text editor operation
|
|
191
|
+
* for the 2025-05-22 Anthropic code execution tool.
|
|
192
|
+
*
|
|
193
|
+
* **Gotchas**
|
|
194
|
+
*
|
|
195
|
+
* The `old_str` must match the file contents exactly, including whitespace and
|
|
196
|
+
* indentation, and must identify a single occurrence.
|
|
197
|
+
*
|
|
198
|
+
* @see {@link CodeExecutionTextEditorView} for reading file contents before choosing the replacement text
|
|
199
|
+
* @see {@link CodeExecution_20250522} for the provider-defined tool that consumes this payload
|
|
121
200
|
*
|
|
122
|
-
* @since 1.0.0
|
|
123
201
|
* @category Code Execution
|
|
202
|
+
* @since 4.0.0
|
|
124
203
|
*/
|
|
125
204
|
export const CodeExecutionTextEditorStrReplace = /*#__PURE__*/Schema.Struct({
|
|
126
205
|
type: /*#__PURE__*/Schema.Literal("text_editor_code_execution"),
|
|
@@ -143,10 +222,17 @@ const CodeExecution_20250522_Parameters = /*#__PURE__*/Schema.Union([CodeExecuti
|
|
|
143
222
|
// Code Execution 20250825 Parameters
|
|
144
223
|
// -----------------------------------------------------------------------------
|
|
145
224
|
/**
|
|
146
|
-
*
|
|
225
|
+
* Schema for the 2025-08-25 code execution tool input, containing the code to execute.
|
|
226
|
+
*
|
|
227
|
+
* **When to use**
|
|
228
|
+
*
|
|
229
|
+
* Use when you need the schema for code-execution input at the Anthropic
|
|
230
|
+
* protocol boundary before sending source code to the 2025-08-25 tool.
|
|
231
|
+
*
|
|
232
|
+
* @see {@link CodeExecution_20250825} for the provider-defined tool that consumes this schema
|
|
147
233
|
*
|
|
148
|
-
* @since 1.0.0
|
|
149
234
|
* @category Code Execution
|
|
235
|
+
* @since 4.0.0
|
|
150
236
|
*/
|
|
151
237
|
export const CodeExecution_20250825_Parameters = /*#__PURE__*/Schema.Struct({
|
|
152
238
|
/**
|
|
@@ -158,14 +244,23 @@ export const CodeExecution_20250825_Parameters = /*#__PURE__*/Schema.Struct({
|
|
|
158
244
|
// Code Execution Tool Definitions
|
|
159
245
|
// -----------------------------------------------------------------------------
|
|
160
246
|
/**
|
|
161
|
-
* Anthropic Code Execution tool (2025-05-22 version).
|
|
247
|
+
* Defines the Anthropic Code Execution tool (2025-05-22 version).
|
|
248
|
+
*
|
|
249
|
+
* **When to use**
|
|
250
|
+
*
|
|
251
|
+
* Use when you want the model to execute code in a sandboxed environment with
|
|
252
|
+
* the 2025-05-22 Anthropic code-execution beta.
|
|
253
|
+
*
|
|
254
|
+
* **Details**
|
|
162
255
|
*
|
|
163
256
|
* Allows the model to execute code in a sandboxed environment with support
|
|
164
257
|
* for multiple execution types including programmatic tool calls, bash
|
|
165
258
|
* execution, and text editor operations.
|
|
166
259
|
*
|
|
167
|
-
* @
|
|
260
|
+
* @see {@link CodeExecutionProgrammaticToolCall} for the programmatic tool call schema
|
|
261
|
+
*
|
|
168
262
|
* @category Code Execution
|
|
263
|
+
* @since 4.0.0
|
|
169
264
|
*/
|
|
170
265
|
export const CodeExecution_20250522 = /*#__PURE__*/Tool.providerDefined({
|
|
171
266
|
id: "anthropic.code_execution_20250522",
|
|
@@ -176,12 +271,23 @@ export const CodeExecution_20250522 = /*#__PURE__*/Tool.providerDefined({
|
|
|
176
271
|
failure: Generated.BetaResponseCodeExecutionToolResultError
|
|
177
272
|
});
|
|
178
273
|
/**
|
|
179
|
-
* Anthropic Code Execution tool (2025-08-25 version).
|
|
274
|
+
* Defines the Anthropic Code Execution tool (2025-08-25 version).
|
|
275
|
+
*
|
|
276
|
+
* **When to use**
|
|
277
|
+
*
|
|
278
|
+
* Use when you want the model to execute code in a sandboxed environment with
|
|
279
|
+
* the 2025-08-25 Anthropic code-execution beta.
|
|
280
|
+
*
|
|
281
|
+
* **Details**
|
|
282
|
+
*
|
|
283
|
+
* Requires the `code-execution-2025-08-25` beta header and uses
|
|
284
|
+
* `CodeExecution_20250825_Parameters` as its input schema.
|
|
180
285
|
*
|
|
181
|
-
*
|
|
286
|
+
* @see {@link CodeExecution_20250522} for the older 2025-05-22 code execution tool
|
|
287
|
+
* @see {@link CodeExecution_20250825_Parameters} for the input schema consumed by this tool
|
|
182
288
|
*
|
|
183
|
-
* @since 1.0.0
|
|
184
289
|
* @category Code Execution
|
|
290
|
+
* @since 4.0.0
|
|
185
291
|
*/
|
|
186
292
|
export const CodeExecution_20250825 = /*#__PURE__*/Tool.providerDefined({
|
|
187
293
|
id: "anthropic.code_execution_20250825",
|
|
@@ -198,31 +304,65 @@ export const CodeExecution_20250825 = /*#__PURE__*/Tool.providerDefined({
|
|
|
198
304
|
// Common Types
|
|
199
305
|
// -----------------------------------------------------------------------------
|
|
200
306
|
/**
|
|
201
|
-
*
|
|
307
|
+
* Schema for an `[x, y]` screen coordinate in pixels.
|
|
202
308
|
*
|
|
203
|
-
*
|
|
204
|
-
*
|
|
309
|
+
* **When to use**
|
|
310
|
+
*
|
|
311
|
+
* Use when validating computer-use action payloads that carry a single screen
|
|
312
|
+
* position and provider-side bounds checks remain acceptable.
|
|
313
|
+
*
|
|
314
|
+
* **Details**
|
|
315
|
+
*
|
|
316
|
+
* This is a two-number tuple used by computer-use actions that accept screen
|
|
317
|
+
* positions.
|
|
318
|
+
*
|
|
319
|
+
* **Gotchas**
|
|
320
|
+
*
|
|
321
|
+
* This schema validates tuple shape only and does not check display bounds.
|
|
322
|
+
*
|
|
323
|
+
* @category computer use
|
|
324
|
+
* @since 4.0.0
|
|
205
325
|
*/
|
|
206
326
|
export const Coordinate = /*#__PURE__*/Schema.Tuple([Schema.Number, Schema.Number]);
|
|
207
327
|
/**
|
|
208
|
-
*
|
|
328
|
+
* Schema for an `[x1, y1, x2, y2]` screen region in pixels.
|
|
329
|
+
*
|
|
330
|
+
* **When to use**
|
|
331
|
+
*
|
|
332
|
+
* Use when validating computer-use action payloads that carry a rectangular
|
|
333
|
+
* screen region and provider-side bounds checks remain acceptable.
|
|
209
334
|
*
|
|
210
|
-
*
|
|
211
|
-
*
|
|
335
|
+
* **Details**
|
|
336
|
+
*
|
|
337
|
+
* The tuple represents top-left and bottom-right corners.
|
|
338
|
+
*
|
|
339
|
+
* **Gotchas**
|
|
340
|
+
*
|
|
341
|
+
* This schema validates four numbers only and does not check coordinate ordering
|
|
342
|
+
* or display bounds.
|
|
343
|
+
*
|
|
344
|
+
* @category computer use
|
|
345
|
+
* @since 4.0.0
|
|
212
346
|
*/
|
|
213
347
|
export const Region = /*#__PURE__*/Schema.Tuple([Schema.Number, Schema.Number, Schema.Number, Schema.Number]);
|
|
214
348
|
/**
|
|
215
|
-
*
|
|
349
|
+
* Schema for scroll direction literals: `"up"`, `"down"`, `"left"`, or `"right"`.
|
|
350
|
+
*
|
|
351
|
+
* @see {@link ComputerUseScrollAction} for the action payload that consumes this schema
|
|
216
352
|
*
|
|
217
|
-
* @
|
|
218
|
-
* @
|
|
353
|
+
* @category computer use
|
|
354
|
+
* @since 4.0.0
|
|
219
355
|
*/
|
|
220
356
|
export const ScrollDirection = /*#__PURE__*/Schema.Literals(["up", "down", "left", "right"]);
|
|
221
357
|
/**
|
|
222
|
-
*
|
|
358
|
+
* Schema for modifier key literals.
|
|
223
359
|
*
|
|
224
|
-
*
|
|
225
|
-
*
|
|
360
|
+
* **Details**
|
|
361
|
+
*
|
|
362
|
+
* Allowed values are `"alt"`, `"ctrl"`, `"meta"`, and `"shift"`.
|
|
363
|
+
*
|
|
364
|
+
* @category computer use
|
|
365
|
+
* @since 4.0.0
|
|
226
366
|
*/
|
|
227
367
|
export const ModifierKey = /*#__PURE__*/Schema.Literals(["alt", "ctrl", "meta", "shift"]);
|
|
228
368
|
// -----------------------------------------------------------------------------
|
|
@@ -252,10 +392,19 @@ const ComputerUse_20251124_Args = /*#__PURE__*/Schema.Struct({
|
|
|
252
392
|
// Computer Use 20241022 Actions
|
|
253
393
|
// -----------------------------------------------------------------------------
|
|
254
394
|
/**
|
|
255
|
-
*
|
|
395
|
+
* Schema for a computer-use action that presses a key or key combination, such
|
|
396
|
+
* as `"Return"`, `"ctrl+c"`, or `"ctrl+s"`.
|
|
397
|
+
*
|
|
398
|
+
* **When to use**
|
|
399
|
+
*
|
|
400
|
+
* Use when validating or constructing a computer-use action for keyboard
|
|
401
|
+
* shortcuts or non-text key presses.
|
|
256
402
|
*
|
|
257
|
-
* @
|
|
258
|
-
* @
|
|
403
|
+
* @see {@link TypeAction} for entering ordinary text strings
|
|
404
|
+
* @see {@link ComputerUseHoldKeyAction} for holding a key for a duration
|
|
405
|
+
*
|
|
406
|
+
* @category computer use
|
|
407
|
+
* @since 4.0.0
|
|
259
408
|
*/
|
|
260
409
|
export const ComputerUseKeyAction = /*#__PURE__*/Schema.Struct({
|
|
261
410
|
action: /*#__PURE__*/Schema.Literal("key"),
|
|
@@ -265,10 +414,30 @@ export const ComputerUseKeyAction = /*#__PURE__*/Schema.Struct({
|
|
|
265
414
|
text: Schema.String
|
|
266
415
|
});
|
|
267
416
|
/**
|
|
268
|
-
*
|
|
417
|
+
* Schema for a computer-use action that performs a left click.
|
|
418
|
+
*
|
|
419
|
+
* **When to use**
|
|
420
|
+
*
|
|
421
|
+
* Use to validate or construct an Anthropic computer-use payload for clicking
|
|
422
|
+
* once at the current mouse position or at a specific screen coordinate.
|
|
423
|
+
*
|
|
424
|
+
* **Details**
|
|
425
|
+
*
|
|
426
|
+
* The encoded payload uses `action: "left_click"`. The optional `coordinate`
|
|
427
|
+
* field supplies the `[x, y]` pixel position; when omitted, the action uses the
|
|
428
|
+
* current mouse position.
|
|
429
|
+
*
|
|
430
|
+
* **Gotchas**
|
|
431
|
+
*
|
|
432
|
+
* The coordinate schema only checks that the value is a two-number tuple. It
|
|
433
|
+
* does not validate that the point falls within the configured display
|
|
434
|
+
* dimensions.
|
|
435
|
+
*
|
|
436
|
+
* @see {@link ComputerUseDoubleClickAction} for performing a double click
|
|
437
|
+
* @see {@link ComputerUseMouseMoveAction} for moving the mouse without clicking
|
|
269
438
|
*
|
|
270
|
-
* @
|
|
271
|
-
* @
|
|
439
|
+
* @category computer use
|
|
440
|
+
* @since 4.0.0
|
|
272
441
|
*/
|
|
273
442
|
export const ComputerUseLeftClickAction = /*#__PURE__*/Schema.Struct({
|
|
274
443
|
action: /*#__PURE__*/Schema.Literal("left_click"),
|
|
@@ -279,10 +448,27 @@ export const ComputerUseLeftClickAction = /*#__PURE__*/Schema.Struct({
|
|
|
279
448
|
coordinate: /*#__PURE__*/Schema.optional(Coordinate)
|
|
280
449
|
});
|
|
281
450
|
/**
|
|
282
|
-
*
|
|
451
|
+
* Schema for a computer-use action that moves the mouse cursor to a required
|
|
452
|
+
* `[x, y]` screen coordinate.
|
|
283
453
|
*
|
|
284
|
-
*
|
|
285
|
-
*
|
|
454
|
+
* **When to use**
|
|
455
|
+
*
|
|
456
|
+
* Use to validate or construct a mouse movement action for an Anthropic
|
|
457
|
+
* computer-use tool call.
|
|
458
|
+
*
|
|
459
|
+
* **Details**
|
|
460
|
+
*
|
|
461
|
+
* The encoded payload has action `"mouse_move"` and a required `coordinate`
|
|
462
|
+
* field containing the target `[x, y]` pixel position.
|
|
463
|
+
*
|
|
464
|
+
* **Gotchas**
|
|
465
|
+
*
|
|
466
|
+
* The coordinate schema only checks that the value is a two-number tuple. It
|
|
467
|
+
* does not validate that the point falls within the configured display
|
|
468
|
+
* dimensions.
|
|
469
|
+
*
|
|
470
|
+
* @category computer use
|
|
471
|
+
* @since 4.0.0
|
|
286
472
|
*/
|
|
287
473
|
export const ComputerUseMouseMoveAction = /*#__PURE__*/Schema.Struct({
|
|
288
474
|
action: /*#__PURE__*/Schema.Literal("mouse_move"),
|
|
@@ -292,19 +478,43 @@ export const ComputerUseMouseMoveAction = /*#__PURE__*/Schema.Struct({
|
|
|
292
478
|
coordinate: Coordinate
|
|
293
479
|
});
|
|
294
480
|
/**
|
|
295
|
-
*
|
|
481
|
+
* Schema for a computer-use action that requests a screenshot of the current display.
|
|
482
|
+
*
|
|
483
|
+
* **When to use**
|
|
484
|
+
*
|
|
485
|
+
* Use to validate or construct a computer-use tool action that asks the handler
|
|
486
|
+
* to capture the full current display.
|
|
487
|
+
*
|
|
488
|
+
* **Details**
|
|
296
489
|
*
|
|
297
|
-
*
|
|
298
|
-
*
|
|
490
|
+
* The payload contains only `action: "screenshot"` and does not include
|
|
491
|
+
* coordinates or other options.
|
|
492
|
+
*
|
|
493
|
+
* @see {@link ComputerUseZoomAction} for requesting a zoomed-in screenshot of a specific screen region with the 2025-11-24 computer-use tool
|
|
494
|
+
*
|
|
495
|
+
* @category computer use
|
|
496
|
+
* @since 4.0.0
|
|
299
497
|
*/
|
|
300
498
|
export const ComputerUseScreenshotAction = /*#__PURE__*/Schema.Struct({
|
|
301
499
|
action: /*#__PURE__*/Schema.Literal("screenshot")
|
|
302
500
|
});
|
|
303
501
|
/**
|
|
304
|
-
*
|
|
502
|
+
* Schema for a computer-use action that enters text.
|
|
503
|
+
*
|
|
504
|
+
* **When to use**
|
|
505
|
+
*
|
|
506
|
+
* Use to validate or construct a computer-use action for entering ordinary text
|
|
507
|
+
* strings.
|
|
305
508
|
*
|
|
306
|
-
*
|
|
307
|
-
*
|
|
509
|
+
* **Details**
|
|
510
|
+
*
|
|
511
|
+
* The payload uses `action: "type"` and a `text` string containing the text to
|
|
512
|
+
* enter.
|
|
513
|
+
*
|
|
514
|
+
* @see {@link ComputerUseKeyAction} for key presses and keyboard shortcuts
|
|
515
|
+
*
|
|
516
|
+
* @category computer use
|
|
517
|
+
* @since 4.0.0
|
|
308
518
|
*/
|
|
309
519
|
export const TypeAction = /*#__PURE__*/Schema.Struct({
|
|
310
520
|
action: /*#__PURE__*/Schema.Literal("type"),
|
|
@@ -318,10 +528,29 @@ const ComputerUse_20241022_Actions = /*#__PURE__*/Schema.Union([ComputerUseKeyAc
|
|
|
318
528
|
// Computer Use 20250124 Actions
|
|
319
529
|
// -----------------------------------------------------------------------------
|
|
320
530
|
/**
|
|
321
|
-
*
|
|
531
|
+
* Schema for a computer-use action that performs a double click.
|
|
532
|
+
*
|
|
533
|
+
* **When to use**
|
|
322
534
|
*
|
|
323
|
-
*
|
|
324
|
-
*
|
|
535
|
+
* Use to validate or construct an Anthropic computer-use payload for double
|
|
536
|
+
* clicking at the current mouse position or at a specific screen coordinate.
|
|
537
|
+
*
|
|
538
|
+
* **Details**
|
|
539
|
+
*
|
|
540
|
+
* The encoded payload uses `action: "double_click"`. The optional
|
|
541
|
+
* `coordinate` field supplies the `[x, y]` pixel position; when omitted, the
|
|
542
|
+
* action uses the current mouse position.
|
|
543
|
+
*
|
|
544
|
+
* **Gotchas**
|
|
545
|
+
*
|
|
546
|
+
* The coordinate schema only checks that the value is a two-number tuple. It
|
|
547
|
+
* does not validate that the point falls within the configured display
|
|
548
|
+
* dimensions.
|
|
549
|
+
*
|
|
550
|
+
* @see {@link ComputerUseLeftClickAction} for performing a single left click
|
|
551
|
+
*
|
|
552
|
+
* @category computer use
|
|
553
|
+
* @since 4.0.0
|
|
325
554
|
*/
|
|
326
555
|
export const ComputerUseDoubleClickAction = /*#__PURE__*/Schema.Struct({
|
|
327
556
|
action: /*#__PURE__*/Schema.Literal("double_click"),
|
|
@@ -332,10 +561,29 @@ export const ComputerUseDoubleClickAction = /*#__PURE__*/Schema.Struct({
|
|
|
332
561
|
coordinate: /*#__PURE__*/Schema.optional(Coordinate)
|
|
333
562
|
});
|
|
334
563
|
/**
|
|
335
|
-
*
|
|
564
|
+
* Keeps a key pressed for a specified duration during computer-use execution.
|
|
565
|
+
*
|
|
566
|
+
* **When to use**
|
|
567
|
+
*
|
|
568
|
+
* Use to keep a keyboard key depressed for a fixed number of seconds in a
|
|
569
|
+
* computer-use action sequence.
|
|
570
|
+
*
|
|
571
|
+
* **Details**
|
|
336
572
|
*
|
|
337
|
-
*
|
|
338
|
-
*
|
|
573
|
+
* The schema describes objects with `action: "hold_key"`, a `text` field
|
|
574
|
+
* containing the key to hold, and a `duration` field containing the number of
|
|
575
|
+
* seconds to hold it.
|
|
576
|
+
*
|
|
577
|
+
* **Gotchas**
|
|
578
|
+
*
|
|
579
|
+
* The schema only checks that `duration` is a number; it does not require a
|
|
580
|
+
* positive value.
|
|
581
|
+
*
|
|
582
|
+
* @see {@link ComputerUseKeyAction} for pressing a key or key combination without holding it
|
|
583
|
+
* @see {@link ComputerUseWaitAction} for pausing between actions without holding a key
|
|
584
|
+
*
|
|
585
|
+
* @category computer use
|
|
586
|
+
* @since 4.0.0
|
|
339
587
|
*/
|
|
340
588
|
export const ComputerUseHoldKeyAction = /*#__PURE__*/Schema.Struct({
|
|
341
589
|
action: /*#__PURE__*/Schema.Literal("hold_key"),
|
|
@@ -349,10 +597,29 @@ export const ComputerUseHoldKeyAction = /*#__PURE__*/Schema.Struct({
|
|
|
349
597
|
duration: Schema.Number
|
|
350
598
|
});
|
|
351
599
|
/**
|
|
352
|
-
*
|
|
600
|
+
* Schema for a computer-use action that drags with the left mouse button.
|
|
601
|
+
*
|
|
602
|
+
* **When to use**
|
|
603
|
+
*
|
|
604
|
+
* Use to validate or construct an Anthropic computer-use payload for dragging
|
|
605
|
+
* from one screen coordinate to another in a single action.
|
|
606
|
+
*
|
|
607
|
+
* **Details**
|
|
608
|
+
*
|
|
609
|
+
* The encoded payload uses `action: "left_click_drag"` and requires both
|
|
610
|
+
* `start_coordinate` and `coordinate` as `[x, y]` pixel positions.
|
|
353
611
|
*
|
|
354
|
-
*
|
|
355
|
-
*
|
|
612
|
+
* **Gotchas**
|
|
613
|
+
*
|
|
614
|
+
* The coordinate schema only checks that each value is a two-number tuple. It
|
|
615
|
+
* does not validate that either point falls within the configured display
|
|
616
|
+
* dimensions.
|
|
617
|
+
*
|
|
618
|
+
* @see {@link ComputerUseLeftMouseDownAction} for starting a manual drag sequence
|
|
619
|
+
* @see {@link ComputerUseLeftMouseUpAction} for ending a manual drag sequence
|
|
620
|
+
*
|
|
621
|
+
* @category computer use
|
|
622
|
+
* @since 4.0.0
|
|
356
623
|
*/
|
|
357
624
|
export const ComputerUseLeftClickDragAction = /*#__PURE__*/Schema.Struct({
|
|
358
625
|
action: /*#__PURE__*/Schema.Literal("left_click_drag"),
|
|
@@ -366,12 +633,15 @@ export const ComputerUseLeftClickDragAction = /*#__PURE__*/Schema.Struct({
|
|
|
366
633
|
coordinate: Coordinate
|
|
367
634
|
});
|
|
368
635
|
/**
|
|
369
|
-
*
|
|
636
|
+
* Starts a left mouse button press without releasing it.
|
|
370
637
|
*
|
|
371
|
-
*
|
|
638
|
+
* **When to use**
|
|
372
639
|
*
|
|
373
|
-
*
|
|
374
|
-
*
|
|
640
|
+
* Use when constructing a manual click or drag sequence that should press and
|
|
641
|
+
* hold the left mouse button before a later release.
|
|
642
|
+
*
|
|
643
|
+
* @category computer use
|
|
644
|
+
* @since 4.0.0
|
|
375
645
|
*/
|
|
376
646
|
export const ComputerUseLeftMouseDownAction = /*#__PURE__*/Schema.Struct({
|
|
377
647
|
action: /*#__PURE__*/Schema.Literal("left_mouse_down"),
|
|
@@ -382,12 +652,15 @@ export const ComputerUseLeftMouseDownAction = /*#__PURE__*/Schema.Struct({
|
|
|
382
652
|
coordinate: /*#__PURE__*/Schema.optional(Coordinate)
|
|
383
653
|
});
|
|
384
654
|
/**
|
|
385
|
-
*
|
|
655
|
+
* Releases the left mouse button.
|
|
656
|
+
*
|
|
657
|
+
* **When to use**
|
|
386
658
|
*
|
|
387
|
-
*
|
|
659
|
+
* Use when constructing a manual click or drag sequence that should release the
|
|
660
|
+
* left mouse button after it was previously held down.
|
|
388
661
|
*
|
|
389
|
-
* @
|
|
390
|
-
* @
|
|
662
|
+
* @category computer use
|
|
663
|
+
* @since 4.0.0
|
|
391
664
|
*/
|
|
392
665
|
export const ComputerUseLeftMouseUpAction = /*#__PURE__*/Schema.Struct({
|
|
393
666
|
action: /*#__PURE__*/Schema.Literal("left_mouse_up"),
|
|
@@ -398,10 +671,29 @@ export const ComputerUseLeftMouseUpAction = /*#__PURE__*/Schema.Struct({
|
|
|
398
671
|
coordinate: /*#__PURE__*/Schema.optional(Coordinate)
|
|
399
672
|
});
|
|
400
673
|
/**
|
|
401
|
-
*
|
|
674
|
+
* Schema for a computer-use action that performs a middle click.
|
|
675
|
+
*
|
|
676
|
+
* **When to use**
|
|
677
|
+
*
|
|
678
|
+
* Use to validate or construct a middle-button click action for Anthropic
|
|
679
|
+
* computer use, optionally targeting a specific screen coordinate.
|
|
680
|
+
*
|
|
681
|
+
* **Details**
|
|
682
|
+
*
|
|
683
|
+
* The payload must use `action: "middle_click"`. When `coordinate` is omitted,
|
|
684
|
+
* the click occurs at the current mouse position.
|
|
402
685
|
*
|
|
403
|
-
*
|
|
404
|
-
*
|
|
686
|
+
* **Gotchas**
|
|
687
|
+
*
|
|
688
|
+
* This action is available in the 2025-01-24 computer-use action set and later;
|
|
689
|
+
* it is not part of `ComputerUse_20241022`.
|
|
690
|
+
*
|
|
691
|
+
* @see {@link ComputerUse_20250124} for the provider-defined tool version that first accepts this action
|
|
692
|
+
* @see {@link ComputerUseLeftClickAction} for primary-button clicks
|
|
693
|
+
* @see {@link ComputerUseRightClickAction} for secondary-button clicks
|
|
694
|
+
*
|
|
695
|
+
* @category computer use
|
|
696
|
+
* @since 4.0.0
|
|
405
697
|
*/
|
|
406
698
|
export const ComputerUseMiddleClickAction = /*#__PURE__*/Schema.Struct({
|
|
407
699
|
action: /*#__PURE__*/Schema.Literal("middle_click"),
|
|
@@ -412,10 +704,25 @@ export const ComputerUseMiddleClickAction = /*#__PURE__*/Schema.Struct({
|
|
|
412
704
|
coordinate: /*#__PURE__*/Schema.optional(Coordinate)
|
|
413
705
|
});
|
|
414
706
|
/**
|
|
415
|
-
*
|
|
707
|
+
* Schema for a computer-use action that performs a right click, optionally at a
|
|
708
|
+
* specific screen coordinate.
|
|
709
|
+
*
|
|
710
|
+
* **When to use**
|
|
711
|
+
*
|
|
712
|
+
* Use to validate or construct the `right_click` action for an Anthropic
|
|
713
|
+
* computer-use tool call.
|
|
714
|
+
*
|
|
715
|
+
* **Details**
|
|
716
|
+
*
|
|
717
|
+
* The optional `coordinate` field is an `[x, y]` screen coordinate in pixels.
|
|
718
|
+
* When omitted, the right click is performed at the current mouse position.
|
|
719
|
+
*
|
|
720
|
+
* @see {@link ComputerUse_20250124} for the provider-defined computer-use tool version that introduced this action
|
|
721
|
+
* @see {@link ComputerUseLeftClickAction} for the corresponding left-click action
|
|
722
|
+
* @see {@link ComputerUseMiddleClickAction} for the corresponding middle-click action
|
|
416
723
|
*
|
|
417
|
-
* @
|
|
418
|
-
* @
|
|
724
|
+
* @category computer use
|
|
725
|
+
* @since 4.0.0
|
|
419
726
|
*/
|
|
420
727
|
export const ComputerUseRightClickAction = /*#__PURE__*/Schema.Struct({
|
|
421
728
|
action: /*#__PURE__*/Schema.Literal("right_click"),
|
|
@@ -426,10 +733,27 @@ export const ComputerUseRightClickAction = /*#__PURE__*/Schema.Struct({
|
|
|
426
733
|
coordinate: /*#__PURE__*/Schema.optional(Coordinate)
|
|
427
734
|
});
|
|
428
735
|
/**
|
|
429
|
-
*
|
|
736
|
+
* Schema for a computer-use scroll action.
|
|
430
737
|
*
|
|
431
|
-
*
|
|
432
|
-
*
|
|
738
|
+
* **When to use**
|
|
739
|
+
*
|
|
740
|
+
* Use when validating or constructing Anthropic computer-use scroll payloads.
|
|
741
|
+
*
|
|
742
|
+
* **Details**
|
|
743
|
+
*
|
|
744
|
+
* The encoded payload uses `action: "scroll"`, an optional `coordinate`,
|
|
745
|
+
* `scroll_direction`, and `scroll_amount`.
|
|
746
|
+
*
|
|
747
|
+
* **Gotchas**
|
|
748
|
+
*
|
|
749
|
+
* `coordinate` only checks a two-number tuple, and `scroll_amount` is only
|
|
750
|
+
* `Schema.Number`.
|
|
751
|
+
*
|
|
752
|
+
* @see {@link ComputerUse_20250124} for the tool version that accepts this action
|
|
753
|
+
* @see {@link ScrollDirection} for the accepted direction literals
|
|
754
|
+
*
|
|
755
|
+
* @category computer use
|
|
756
|
+
* @since 4.0.0
|
|
433
757
|
*/
|
|
434
758
|
export const ComputerUseScrollAction = /*#__PURE__*/Schema.Struct({
|
|
435
759
|
action: /*#__PURE__*/Schema.Literal("scroll"),
|
|
@@ -448,10 +772,29 @@ export const ComputerUseScrollAction = /*#__PURE__*/Schema.Struct({
|
|
|
448
772
|
scroll_amount: Schema.Number
|
|
449
773
|
});
|
|
450
774
|
/**
|
|
451
|
-
*
|
|
775
|
+
* Schema for a computer-use triple-click action.
|
|
776
|
+
*
|
|
777
|
+
* **When to use**
|
|
778
|
+
*
|
|
779
|
+
* Use when validating or constructing Anthropic computer-use triple-click
|
|
780
|
+
* payloads at the current pointer position or an optional coordinate.
|
|
452
781
|
*
|
|
453
|
-
*
|
|
454
|
-
*
|
|
782
|
+
* **Details**
|
|
783
|
+
*
|
|
784
|
+
* The encoded payload uses `action: "triple_click"` and an optional
|
|
785
|
+
* `coordinate`.
|
|
786
|
+
*
|
|
787
|
+
* **Gotchas**
|
|
788
|
+
*
|
|
789
|
+
* `coordinate` only validates as a two-number tuple and does not check display
|
|
790
|
+
* bounds.
|
|
791
|
+
*
|
|
792
|
+
* @see {@link ComputerUse_20250124} for the tool version that accepts this action
|
|
793
|
+
* @see {@link ComputerUseDoubleClickAction} for the two-click variant
|
|
794
|
+
* @see {@link ComputerUseLeftClickAction} for a single left click
|
|
795
|
+
*
|
|
796
|
+
* @category computer use
|
|
797
|
+
* @since 4.0.0
|
|
455
798
|
*/
|
|
456
799
|
export const ComputerUseTripleClickAction = /*#__PURE__*/Schema.Struct({
|
|
457
800
|
action: /*#__PURE__*/Schema.Literal("triple_click"),
|
|
@@ -462,10 +805,28 @@ export const ComputerUseTripleClickAction = /*#__PURE__*/Schema.Struct({
|
|
|
462
805
|
coordinate: /*#__PURE__*/Schema.optional(Coordinate)
|
|
463
806
|
});
|
|
464
807
|
/**
|
|
465
|
-
*
|
|
808
|
+
* Schema for a computer-use wait action.
|
|
809
|
+
*
|
|
810
|
+
* **When to use**
|
|
811
|
+
*
|
|
812
|
+
* Use when validating or constructing Anthropic computer-use payloads that pause
|
|
813
|
+
* between actions.
|
|
814
|
+
*
|
|
815
|
+
* **Details**
|
|
466
816
|
*
|
|
467
|
-
*
|
|
468
|
-
*
|
|
817
|
+
* The encoded payload uses `action: "wait"` and a required `duration` in
|
|
818
|
+
* seconds.
|
|
819
|
+
*
|
|
820
|
+
* **Gotchas**
|
|
821
|
+
*
|
|
822
|
+
* `duration` is only `Schema.Number`; it is not constrained to positive or
|
|
823
|
+
* finite values.
|
|
824
|
+
*
|
|
825
|
+
* @see {@link ComputerUseHoldKeyAction} for another duration-based computer-use action
|
|
826
|
+
* @see {@link ComputerUse_20250124} for the tool version that accepts this action
|
|
827
|
+
*
|
|
828
|
+
* @category computer use
|
|
829
|
+
* @since 4.0.0
|
|
469
830
|
*/
|
|
470
831
|
export const ComputerUseWaitAction = /*#__PURE__*/Schema.Struct({
|
|
471
832
|
action: /*#__PURE__*/Schema.Literal("wait"),
|
|
@@ -479,12 +840,27 @@ const ComputerUse_20250124_Actions = /*#__PURE__*/Schema.Union([...ComputerUse_2
|
|
|
479
840
|
// Computer Use 20251124 Actions
|
|
480
841
|
// -----------------------------------------------------------------------------
|
|
481
842
|
/**
|
|
482
|
-
*
|
|
843
|
+
* Zooms into a specific region of the screen at full resolution.
|
|
844
|
+
*
|
|
845
|
+
* **When to use**
|
|
846
|
+
*
|
|
847
|
+
* Use when building or validating the 2025-11-24 computer-use action for a
|
|
848
|
+
* zoom-enabled tool definition.
|
|
849
|
+
*
|
|
850
|
+
* **Details**
|
|
851
|
+
*
|
|
852
|
+
* The encoded payload uses `action: "zoom"` and a `region` tuple.
|
|
853
|
+
*
|
|
854
|
+
* **Gotchas**
|
|
483
855
|
*
|
|
484
|
-
* Requires `enableZoom: true` in the tool definition.
|
|
856
|
+
* Requires `enableZoom: true` in the tool definition. `region` is only a
|
|
857
|
+
* four-number tuple and does not validate corner ordering or display bounds.
|
|
485
858
|
*
|
|
486
|
-
* @
|
|
487
|
-
* @
|
|
859
|
+
* @see {@link ComputerUse_20251124} for the tool version that accepts this action
|
|
860
|
+
* @see {@link ComputerUseScreenshotAction} for capturing the full screen instead
|
|
861
|
+
*
|
|
862
|
+
* @category computer use
|
|
863
|
+
* @since 4.0.0
|
|
488
864
|
*/
|
|
489
865
|
export const ComputerUseZoomAction = /*#__PURE__*/Schema.Struct({
|
|
490
866
|
action: /*#__PURE__*/Schema.Literal("zoom"),
|
|
@@ -499,14 +875,15 @@ const ComputerUse_20251124_Actions = /*#__PURE__*/Schema.Union([...ComputerUse_2
|
|
|
499
875
|
// Computer Use Tool Definitions
|
|
500
876
|
// -----------------------------------------------------------------------------
|
|
501
877
|
/**
|
|
502
|
-
*
|
|
878
|
+
* Defines the deprecated computer-use tool for Claude 3.5 Sonnet v2.
|
|
503
879
|
*
|
|
504
|
-
*
|
|
880
|
+
* **Details**
|
|
505
881
|
*
|
|
882
|
+
* Requires the "computer-use-2024-10-22" beta header.
|
|
506
883
|
* Basic actions only: screenshot, left_click, type, key, mouse_move.
|
|
507
884
|
*
|
|
508
|
-
* @
|
|
509
|
-
* @
|
|
885
|
+
* @category computer use
|
|
886
|
+
* @since 4.0.0
|
|
510
887
|
*/
|
|
511
888
|
export const ComputerUse_20241022 = /*#__PURE__*/Tool.providerDefined({
|
|
512
889
|
id: "anthropic.computer_use_20241022",
|
|
@@ -518,16 +895,25 @@ export const ComputerUse_20241022 = /*#__PURE__*/Tool.providerDefined({
|
|
|
518
895
|
success: Schema.String
|
|
519
896
|
});
|
|
520
897
|
/**
|
|
521
|
-
*
|
|
898
|
+
* Defines the computer-use tool for Claude 4 models and Claude Sonnet 3.7.
|
|
522
899
|
*
|
|
523
|
-
*
|
|
900
|
+
* **When to use**
|
|
524
901
|
*
|
|
902
|
+
* Use when you need Anthropic computer use for Claude 4 models or Claude
|
|
903
|
+
* Sonnet 3.7 with the 2025-01-24 action set.
|
|
904
|
+
*
|
|
905
|
+
* **Details**
|
|
906
|
+
*
|
|
907
|
+
* Requires the "computer-use-2025-01-24" beta header.
|
|
525
908
|
* Includes basic actions plus enhanced actions: scroll, left_click_drag,
|
|
526
909
|
* right_click, middle_click, double_click, triple_click, left_mouse_down,
|
|
527
910
|
* left_mouse_up, hold_key, wait.
|
|
528
911
|
*
|
|
529
|
-
* @
|
|
530
|
-
* @
|
|
912
|
+
* @see {@link ComputerUse_20241022} for the older basic action set
|
|
913
|
+
* @see {@link ComputerUse_20251124} for the newer zoom-capable version
|
|
914
|
+
*
|
|
915
|
+
* @category computer use
|
|
916
|
+
* @since 4.0.0
|
|
531
917
|
*/
|
|
532
918
|
export const ComputerUse_20250124 = /*#__PURE__*/Tool.providerDefined({
|
|
533
919
|
id: "anthropic.computer_20250124",
|
|
@@ -539,15 +925,28 @@ export const ComputerUse_20250124 = /*#__PURE__*/Tool.providerDefined({
|
|
|
539
925
|
success: Schema.String
|
|
540
926
|
});
|
|
541
927
|
/**
|
|
542
|
-
*
|
|
928
|
+
* Defines the computer-use tool for Claude Opus 4.5 only.
|
|
543
929
|
*
|
|
544
|
-
*
|
|
930
|
+
* **When to use**
|
|
931
|
+
*
|
|
932
|
+
* Use when you need Anthropic computer use for Claude Opus 4.5 with the
|
|
933
|
+
* 2025-11-24 action set and zoom-capable screen inspection.
|
|
934
|
+
*
|
|
935
|
+
* **Details**
|
|
545
936
|
*
|
|
937
|
+
* Requires the "computer-use-2025-11-24" beta header.
|
|
546
938
|
* Includes all actions from computer_20250124 plus the zoom action for
|
|
547
|
-
* detailed screen region inspection.
|
|
939
|
+
* detailed screen region inspection.
|
|
940
|
+
*
|
|
941
|
+
* **Gotchas**
|
|
548
942
|
*
|
|
549
|
-
*
|
|
550
|
-
*
|
|
943
|
+
* Zoom actions require `enableZoom: true` in args.
|
|
944
|
+
*
|
|
945
|
+
* @see {@link ComputerUse_20250124} for the previous action set without zoom
|
|
946
|
+
* @see {@link ComputerUseZoomAction} for the zoom action payload
|
|
947
|
+
*
|
|
948
|
+
* @category computer use
|
|
949
|
+
* @since 4.0.0
|
|
551
950
|
*/
|
|
552
951
|
export const ComputerUse_20251124 = /*#__PURE__*/Tool.providerDefined({
|
|
553
952
|
id: "anthropic.computer_20251124",
|
|
@@ -565,25 +964,38 @@ export const ComputerUse_20251124 = /*#__PURE__*/Tool.providerDefined({
|
|
|
565
964
|
// Common Types
|
|
566
965
|
// -----------------------------------------------------------------------------
|
|
567
966
|
/**
|
|
568
|
-
*
|
|
967
|
+
* Defines a `[start, end]` line range for viewing file contents.
|
|
968
|
+
*
|
|
969
|
+
* **When to use**
|
|
970
|
+
*
|
|
971
|
+
* Use when constructing or validating `view_range` for memory or text editor
|
|
972
|
+
* view commands.
|
|
569
973
|
*
|
|
570
|
-
*
|
|
974
|
+
* **Details**
|
|
571
975
|
*
|
|
572
|
-
*
|
|
573
|
-
*
|
|
976
|
+
* Lines are 1-indexed. Use `-1` for end to read to the end of the file. For
|
|
977
|
+
* example, `[1, 50]` views lines 1-50 and `[100, -1]` views from line 100 to
|
|
978
|
+
* the end of the file.
|
|
574
979
|
*
|
|
575
|
-
* @
|
|
576
|
-
* @
|
|
980
|
+
* @see {@link MemoryViewCommand} for memory view payloads that use this range
|
|
981
|
+
* @see {@link TextEditorViewCommand} for text editor view payloads that use this range
|
|
982
|
+
*
|
|
983
|
+
* @category memory
|
|
984
|
+
* @since 4.0.0
|
|
577
985
|
*/
|
|
578
986
|
export const ViewRange = /*#__PURE__*/Schema.Tuple([Schema.Number, Schema.Number]);
|
|
579
987
|
// -----------------------------------------------------------------------------
|
|
580
988
|
// Memory 20250818 Commands
|
|
581
989
|
// -----------------------------------------------------------------------------
|
|
582
990
|
/**
|
|
583
|
-
*
|
|
991
|
+
* Schema for the memory tool command that creates a new file at a path.
|
|
992
|
+
*
|
|
993
|
+
* **Details**
|
|
584
994
|
*
|
|
585
|
-
*
|
|
586
|
-
*
|
|
995
|
+
* The payload contains `command: "create"` and a `path` string.
|
|
996
|
+
*
|
|
997
|
+
* @category memory
|
|
998
|
+
* @since 4.0.0
|
|
587
999
|
*/
|
|
588
1000
|
export const MemoryCreateCommand = /*#__PURE__*/Schema.Struct({
|
|
589
1001
|
command: /*#__PURE__*/Schema.Literal("create"),
|
|
@@ -593,23 +1005,35 @@ export const MemoryCreateCommand = /*#__PURE__*/Schema.Struct({
|
|
|
593
1005
|
path: Schema.String
|
|
594
1006
|
});
|
|
595
1007
|
/**
|
|
596
|
-
*
|
|
1008
|
+
* Schema for a memory command that deletes a file or directory.
|
|
597
1009
|
*
|
|
598
|
-
* @
|
|
599
|
-
* @
|
|
1010
|
+
* @category memory
|
|
1011
|
+
* @since 4.0.0
|
|
600
1012
|
*/
|
|
601
1013
|
export const MemoryDeleteCommand = /*#__PURE__*/Schema.Struct({
|
|
602
1014
|
command: /*#__PURE__*/Schema.Literal("delete"),
|
|
603
1015
|
/**
|
|
604
|
-
* The path to the file to delete.
|
|
1016
|
+
* The path to the file or directory to delete.
|
|
605
1017
|
*/
|
|
606
1018
|
path: Schema.String
|
|
607
1019
|
});
|
|
608
1020
|
/**
|
|
609
|
-
*
|
|
1021
|
+
* Schema for the memory `insert` command.
|
|
1022
|
+
*
|
|
1023
|
+
* **When to use**
|
|
1024
|
+
*
|
|
1025
|
+
* Use when validating or constructing `insert` payloads for `Memory_20250818`.
|
|
1026
|
+
*
|
|
1027
|
+
* **Details**
|
|
1028
|
+
*
|
|
1029
|
+
* The payload is discriminated by `command: "insert"` and requires `path`,
|
|
1030
|
+
* `insert_line`, and `insert_text`.
|
|
1031
|
+
*
|
|
1032
|
+
* @see {@link Memory_20250818} for the provider-defined tool that consumes this command
|
|
1033
|
+
* @see {@link MemoryStrReplaceCommand} for replacing existing text instead
|
|
610
1034
|
*
|
|
611
|
-
* @
|
|
612
|
-
* @
|
|
1035
|
+
* @category memory
|
|
1036
|
+
* @since 4.0.0
|
|
613
1037
|
*/
|
|
614
1038
|
export const MemoryInsertCommand = /*#__PURE__*/Schema.Struct({
|
|
615
1039
|
command: /*#__PURE__*/Schema.Literal("insert"),
|
|
@@ -627,10 +1051,15 @@ export const MemoryInsertCommand = /*#__PURE__*/Schema.Struct({
|
|
|
627
1051
|
insert_text: Schema.String
|
|
628
1052
|
});
|
|
629
1053
|
/**
|
|
630
|
-
*
|
|
1054
|
+
* Schema for the memory command that renames or moves a file or directory.
|
|
631
1055
|
*
|
|
632
|
-
*
|
|
633
|
-
*
|
|
1056
|
+
* **Details**
|
|
1057
|
+
*
|
|
1058
|
+
* The payload uses `command: "rename"` and requires `old_path` as the current
|
|
1059
|
+
* path plus `new_path` as the new destination path.
|
|
1060
|
+
*
|
|
1061
|
+
* @category memory
|
|
1062
|
+
* @since 4.0.0
|
|
634
1063
|
*/
|
|
635
1064
|
export const MemoryRenameCommand = /*#__PURE__*/Schema.Struct({
|
|
636
1065
|
command: /*#__PURE__*/Schema.Literal("rename"),
|
|
@@ -644,10 +1073,22 @@ export const MemoryRenameCommand = /*#__PURE__*/Schema.Struct({
|
|
|
644
1073
|
new_path: Schema.String
|
|
645
1074
|
});
|
|
646
1075
|
/**
|
|
647
|
-
*
|
|
1076
|
+
* Schema for the memory `str_replace` command.
|
|
1077
|
+
*
|
|
1078
|
+
* **When to use**
|
|
1079
|
+
*
|
|
1080
|
+
* Use when validating or constructing `str_replace` payloads for
|
|
1081
|
+
* `Memory_20250818`.
|
|
1082
|
+
*
|
|
1083
|
+
* **Details**
|
|
648
1084
|
*
|
|
649
|
-
*
|
|
650
|
-
*
|
|
1085
|
+
* The payload is discriminated by `command: "str_replace"` and requires `path`,
|
|
1086
|
+
* `old_str`, and `new_str`.
|
|
1087
|
+
*
|
|
1088
|
+
* @see {@link Memory_20250818} for the provider-defined tool that consumes this command
|
|
1089
|
+
*
|
|
1090
|
+
* @category memory
|
|
1091
|
+
* @since 4.0.0
|
|
651
1092
|
*/
|
|
652
1093
|
export const MemoryStrReplaceCommand = /*#__PURE__*/Schema.Struct({
|
|
653
1094
|
command: /*#__PURE__*/Schema.Literal("str_replace"),
|
|
@@ -667,13 +1108,18 @@ export const MemoryStrReplaceCommand = /*#__PURE__*/Schema.Struct({
|
|
|
667
1108
|
/**
|
|
668
1109
|
* Shows directory contents or file contents with optional line ranges.
|
|
669
1110
|
*
|
|
670
|
-
*
|
|
671
|
-
*
|
|
1111
|
+
* **Details**
|
|
1112
|
+
*
|
|
1113
|
+
* When used on a file, returns file contents optionally limited by `view_range`.
|
|
1114
|
+
* When used on a directory, lists contents.
|
|
1115
|
+
*
|
|
1116
|
+
* @category memory
|
|
1117
|
+
* @since 4.0.0
|
|
672
1118
|
*/
|
|
673
1119
|
export const MemoryViewCommand = /*#__PURE__*/Schema.Struct({
|
|
674
1120
|
command: /*#__PURE__*/Schema.Literal("view"),
|
|
675
1121
|
/**
|
|
676
|
-
* The path to the file to view.
|
|
1122
|
+
* The path to the file or directory to view.
|
|
677
1123
|
*/
|
|
678
1124
|
path: Schema.String,
|
|
679
1125
|
/**
|
|
@@ -686,13 +1132,15 @@ const Memory_20250818_Commands = /*#__PURE__*/Schema.Union([MemoryCreateCommand,
|
|
|
686
1132
|
// Memory Tool Definitions
|
|
687
1133
|
// -----------------------------------------------------------------------------
|
|
688
1134
|
/**
|
|
689
|
-
*
|
|
1135
|
+
* Defines the memory tool for persistent file operations across conversations.
|
|
1136
|
+
*
|
|
1137
|
+
* **Details**
|
|
690
1138
|
*
|
|
691
1139
|
* Provides commands for creating, viewing, editing, renaming, and deleting
|
|
692
1140
|
* files within the model's memory space.
|
|
693
1141
|
*
|
|
694
|
-
* @
|
|
695
|
-
* @
|
|
1142
|
+
* @category memory
|
|
1143
|
+
* @since 4.0.0
|
|
696
1144
|
*/
|
|
697
1145
|
export const Memory_20250818 = /*#__PURE__*/Tool.providerDefined({
|
|
698
1146
|
id: "anthropic.memory_20250818",
|
|
@@ -708,13 +1156,24 @@ export const Memory_20250818 = /*#__PURE__*/Tool.providerDefined({
|
|
|
708
1156
|
// Text Editor Commands
|
|
709
1157
|
// -----------------------------------------------------------------------------
|
|
710
1158
|
/**
|
|
711
|
-
*
|
|
1159
|
+
* Reads the contents of a file or lists directory contents.
|
|
1160
|
+
*
|
|
1161
|
+
* **When to use**
|
|
1162
|
+
*
|
|
1163
|
+
* Use when validating or constructing the standalone Anthropic Text Editor
|
|
1164
|
+
* `view` command.
|
|
1165
|
+
*
|
|
1166
|
+
* **Details**
|
|
712
1167
|
*
|
|
713
|
-
* When used on a file
|
|
714
|
-
* When used on a directory
|
|
1168
|
+
* When used on a file, returns the file contents, optionally limited to a line
|
|
1169
|
+
* range. When used on a directory, lists all files and subdirectories.
|
|
1170
|
+
* `view_range` is a 1-indexed `[start, end]` tuple where `-1` means through
|
|
1171
|
+
* the end of the file.
|
|
715
1172
|
*
|
|
716
|
-
* @
|
|
717
|
-
*
|
|
1173
|
+
* @see {@link CodeExecutionTextEditorView} for the code-execution variant without `view_range`
|
|
1174
|
+
*
|
|
1175
|
+
* @category text editor
|
|
1176
|
+
* @since 4.0.0
|
|
718
1177
|
*/
|
|
719
1178
|
export const TextEditorViewCommand = /*#__PURE__*/Schema.Struct({
|
|
720
1179
|
command: /*#__PURE__*/Schema.Literal("view"),
|
|
@@ -731,10 +1190,22 @@ export const TextEditorViewCommand = /*#__PURE__*/Schema.Struct({
|
|
|
731
1190
|
/**
|
|
732
1191
|
* Create a new file with specified content.
|
|
733
1192
|
*
|
|
734
|
-
*
|
|
1193
|
+
* **When to use**
|
|
1194
|
+
*
|
|
1195
|
+
* Use when validating or constructing an Anthropic text editor `create`
|
|
1196
|
+
* command.
|
|
1197
|
+
*
|
|
1198
|
+
* **Details**
|
|
1199
|
+
*
|
|
1200
|
+
* The payload is discriminated by `command: "create"` and requires both `path`
|
|
1201
|
+
* and `file_text`.
|
|
735
1202
|
*
|
|
736
|
-
*
|
|
737
|
-
*
|
|
1203
|
+
* **Gotchas**
|
|
1204
|
+
*
|
|
1205
|
+
* Fails if the file already exists. Parent directories must exist.
|
|
1206
|
+
*
|
|
1207
|
+
* @category text editor
|
|
1208
|
+
* @since 4.0.0
|
|
738
1209
|
*/
|
|
739
1210
|
export const TextEditorCreateCommand = /*#__PURE__*/Schema.Struct({
|
|
740
1211
|
command: /*#__PURE__*/Schema.Literal("create"),
|
|
@@ -748,13 +1219,28 @@ export const TextEditorCreateCommand = /*#__PURE__*/Schema.Struct({
|
|
|
748
1219
|
file_text: Schema.String
|
|
749
1220
|
});
|
|
750
1221
|
/**
|
|
751
|
-
*
|
|
1222
|
+
* Replaces a specific string in a file with a new string.
|
|
1223
|
+
*
|
|
1224
|
+
* **When to use**
|
|
1225
|
+
*
|
|
1226
|
+
* Use when validating or constructing standalone Anthropic text editor
|
|
1227
|
+
* `str_replace` commands.
|
|
1228
|
+
*
|
|
1229
|
+
* **Details**
|
|
1230
|
+
*
|
|
1231
|
+
* The payload uses `command: "str_replace"`, `path`, `old_str`, and `new_str`.
|
|
1232
|
+
* `new_str` may be empty to delete text.
|
|
1233
|
+
*
|
|
1234
|
+
* **Gotchas**
|
|
752
1235
|
*
|
|
753
1236
|
* The `old_str` must match exactly (including whitespace and indentation)
|
|
754
1237
|
* and must be unique in the file.
|
|
755
1238
|
*
|
|
756
|
-
* @
|
|
757
|
-
* @
|
|
1239
|
+
* @see {@link TextEditorViewCommand} for reading contents before choosing `old_str`
|
|
1240
|
+
* @see {@link CodeExecutionTextEditorStrReplace} for the code-execution variant
|
|
1241
|
+
*
|
|
1242
|
+
* @category text editor
|
|
1243
|
+
* @since 4.0.0
|
|
758
1244
|
*/
|
|
759
1245
|
export const TextEditorStrReplaceCommand = /*#__PURE__*/Schema.Struct({
|
|
760
1246
|
command: /*#__PURE__*/Schema.Literal("str_replace"),
|
|
@@ -772,12 +1258,15 @@ export const TextEditorStrReplaceCommand = /*#__PURE__*/Schema.Struct({
|
|
|
772
1258
|
new_str: Schema.String
|
|
773
1259
|
});
|
|
774
1260
|
/**
|
|
775
|
-
*
|
|
1261
|
+
* Inserts text at a specific line number in a file.
|
|
1262
|
+
*
|
|
1263
|
+
* **Details**
|
|
776
1264
|
*
|
|
777
|
-
* Inserts the new text
|
|
1265
|
+
* Inserts the new text after the specified line number. Use `0` to insert at
|
|
1266
|
+
* the beginning of the file; other values are 1-indexed.
|
|
778
1267
|
*
|
|
779
|
-
* @
|
|
780
|
-
* @
|
|
1268
|
+
* @category text editor
|
|
1269
|
+
* @since 4.0.0
|
|
781
1270
|
*/
|
|
782
1271
|
export const TextEditorInsertCommand = /*#__PURE__*/Schema.Struct({
|
|
783
1272
|
command: /*#__PURE__*/Schema.Literal("insert"),
|
|
@@ -795,15 +1284,21 @@ export const TextEditorInsertCommand = /*#__PURE__*/Schema.Struct({
|
|
|
795
1284
|
new_str: Schema.String
|
|
796
1285
|
});
|
|
797
1286
|
/**
|
|
798
|
-
*
|
|
1287
|
+
* Undoes the last edit made to a file.
|
|
799
1288
|
*
|
|
800
|
-
*
|
|
1289
|
+
* **Details**
|
|
801
1290
|
*
|
|
802
|
-
*
|
|
803
|
-
*
|
|
1291
|
+
* Reverts the most recent `str_replace`, `insert`, or `create` operation on the
|
|
1292
|
+
* file.
|
|
804
1293
|
*
|
|
805
|
-
*
|
|
806
|
-
*
|
|
1294
|
+
* **Gotchas**
|
|
1295
|
+
*
|
|
1296
|
+
* This command is available in `text_editor_20241022` and
|
|
1297
|
+
* `text_editor_20250124`, but not in `text_editor_20250429` or
|
|
1298
|
+
* `text_editor_20250728`.
|
|
1299
|
+
*
|
|
1300
|
+
* @category text editor
|
|
1301
|
+
* @since 4.0.0
|
|
807
1302
|
*/
|
|
808
1303
|
export const TextEditorUndoEditCommand = /*#__PURE__*/Schema.Struct({
|
|
809
1304
|
command: /*#__PURE__*/Schema.Literal("undo_edit"),
|
|
@@ -828,12 +1323,23 @@ const TextEditor_StrReplaceBasedEdit_Args = /*#__PURE__*/Schema.Struct({
|
|
|
828
1323
|
// Text Editor Tool Definitions
|
|
829
1324
|
// -----------------------------------------------------------------------------
|
|
830
1325
|
/**
|
|
831
|
-
*
|
|
1326
|
+
* Defines the deprecated text editor tool for Claude 3.5 Sonnet.
|
|
832
1327
|
*
|
|
833
|
-
*
|
|
1328
|
+
* **When to use**
|
|
1329
|
+
*
|
|
1330
|
+
* Use when you need the 2024-10-22 `str_replace_editor` compatibility path for
|
|
1331
|
+
* Claude 3.5 Sonnet.
|
|
834
1332
|
*
|
|
835
|
-
*
|
|
836
|
-
*
|
|
1333
|
+
* **Details**
|
|
1334
|
+
*
|
|
1335
|
+
* Requires the "computer-use-2024-10-22" beta header and supports `view`,
|
|
1336
|
+
* `create`, `str_replace`, `insert`, and `undo_edit` commands.
|
|
1337
|
+
*
|
|
1338
|
+
* @see {@link TextEditor_20250124} for the newer `str_replace_editor` version
|
|
1339
|
+
* @see {@link TextEditor_20250728} for the Claude 4 `str_replace_based_edit_tool` line
|
|
1340
|
+
*
|
|
1341
|
+
* @category text editor
|
|
1342
|
+
* @since 4.0.0
|
|
837
1343
|
*/
|
|
838
1344
|
export const TextEditor_20241022 = /*#__PURE__*/Tool.providerDefined({
|
|
839
1345
|
id: "anthropic.text_editor_20241022",
|
|
@@ -844,10 +1350,23 @@ export const TextEditor_20241022 = /*#__PURE__*/Tool.providerDefined({
|
|
|
844
1350
|
success: Schema.String
|
|
845
1351
|
});
|
|
846
1352
|
/**
|
|
847
|
-
*
|
|
1353
|
+
* Defines the text editor tool for deprecated Claude Sonnet 3.7.
|
|
1354
|
+
*
|
|
1355
|
+
* **When to use**
|
|
848
1356
|
*
|
|
849
|
-
*
|
|
850
|
-
*
|
|
1357
|
+
* Use when you need the 2025-01-24 Claude Sonnet 3.7 text editor tool using
|
|
1358
|
+
* `str_replace_editor`.
|
|
1359
|
+
*
|
|
1360
|
+
* **Details**
|
|
1361
|
+
*
|
|
1362
|
+
* Requires the "computer-use-2025-01-24" beta header, requires a handler, and
|
|
1363
|
+
* supports `view`, `create`, `str_replace`, `insert`, and `undo_edit` commands.
|
|
1364
|
+
*
|
|
1365
|
+
* @see {@link TextEditor_20241022} for the older `str_replace_editor` version
|
|
1366
|
+
* @see {@link TextEditor_20250429} for the Claude 4 `str_replace_based_edit_tool` line
|
|
1367
|
+
*
|
|
1368
|
+
* @category text editor
|
|
1369
|
+
* @since 4.0.0
|
|
851
1370
|
*/
|
|
852
1371
|
export const TextEditor_20250124 = /*#__PURE__*/Tool.providerDefined({
|
|
853
1372
|
id: "anthropic.text_editor_20250124",
|
|
@@ -858,12 +1377,26 @@ export const TextEditor_20250124 = /*#__PURE__*/Tool.providerDefined({
|
|
|
858
1377
|
success: Schema.String
|
|
859
1378
|
});
|
|
860
1379
|
/**
|
|
861
|
-
*
|
|
1380
|
+
* Defines the text editor tool for Claude 4 models using Anthropic's `str_replace_based_edit_tool`.
|
|
1381
|
+
*
|
|
1382
|
+
* **When to use**
|
|
1383
|
+
*
|
|
1384
|
+
* Use when you need the 2025-04-29 Claude 4 `str_replace_based_edit_tool`
|
|
1385
|
+
* version.
|
|
1386
|
+
*
|
|
1387
|
+
* **Details**
|
|
1388
|
+
*
|
|
1389
|
+
* Requires the "computer-use-2025-01-24" beta header.
|
|
862
1390
|
*
|
|
863
|
-
*
|
|
1391
|
+
* **Gotchas**
|
|
864
1392
|
*
|
|
865
|
-
*
|
|
866
|
-
*
|
|
1393
|
+
* This version does not support the `undo_edit` command.
|
|
1394
|
+
*
|
|
1395
|
+
* @see {@link TextEditor_20250124} for the previous `str_replace_editor` version
|
|
1396
|
+
* @see {@link TextEditor_20250728} for the later Claude 4 text editor version
|
|
1397
|
+
*
|
|
1398
|
+
* @category text editor
|
|
1399
|
+
* @since 4.0.0
|
|
867
1400
|
*/
|
|
868
1401
|
export const TextEditor_20250429 = /*#__PURE__*/Tool.providerDefined({
|
|
869
1402
|
id: "anthropic.text_editor_20250429",
|
|
@@ -875,12 +1408,19 @@ export const TextEditor_20250429 = /*#__PURE__*/Tool.providerDefined({
|
|
|
875
1408
|
success: Schema.String
|
|
876
1409
|
});
|
|
877
1410
|
/**
|
|
878
|
-
*
|
|
1411
|
+
* Defines the text editor tool for Claude 4 models.
|
|
1412
|
+
*
|
|
1413
|
+
* **Details**
|
|
1414
|
+
*
|
|
1415
|
+
* Uses Anthropic's `str_replace_based_edit_tool`. `max_characters` can limit
|
|
1416
|
+
* file-view output for this version.
|
|
879
1417
|
*
|
|
880
|
-
*
|
|
1418
|
+
* **Gotchas**
|
|
881
1419
|
*
|
|
882
|
-
*
|
|
883
|
-
*
|
|
1420
|
+
* This version does not support the `undo_edit` command.
|
|
1421
|
+
*
|
|
1422
|
+
* @category text editor
|
|
1423
|
+
* @since 4.0.0
|
|
884
1424
|
*/
|
|
885
1425
|
export const TextEditor_20250728 = /*#__PURE__*/Tool.providerDefined({
|
|
886
1426
|
id: "anthropic.text_editor_20250728",
|
|
@@ -898,13 +1438,23 @@ export const TextEditor_20250728 = /*#__PURE__*/Tool.providerDefined({
|
|
|
898
1438
|
// Web Search Types
|
|
899
1439
|
// -----------------------------------------------------------------------------
|
|
900
1440
|
/**
|
|
901
|
-
*
|
|
1441
|
+
* Describes user location for localizing search results.
|
|
1442
|
+
*
|
|
1443
|
+
* **When to use**
|
|
1444
|
+
*
|
|
1445
|
+
* Use when you need to localize search results for location-dependent queries
|
|
1446
|
+
* like weather, local businesses, or events.
|
|
1447
|
+
*
|
|
1448
|
+
* **Details**
|
|
902
1449
|
*
|
|
903
|
-
*
|
|
904
|
-
*
|
|
1450
|
+
* The schema uses `type: "approximate"` plus optional `city`, `region`,
|
|
1451
|
+
* `country`, and `timezone`. `country` is an ISO 3166-1 alpha-2 code, and
|
|
1452
|
+
* `timezone` is an IANA time zone identifier.
|
|
1453
|
+
*
|
|
1454
|
+
* @see {@link WebSearch_20250305_Args} for the argument schema that consumes this location
|
|
905
1455
|
*
|
|
906
|
-
* @since 1.0.0
|
|
907
1456
|
* @category Web Search
|
|
1457
|
+
* @since 4.0.0
|
|
908
1458
|
*/
|
|
909
1459
|
export const WebSearchUserLocation = /*#__PURE__*/Schema.Struct({
|
|
910
1460
|
/**
|
|
@@ -932,10 +1482,27 @@ export const WebSearchUserLocation = /*#__PURE__*/Schema.Struct({
|
|
|
932
1482
|
// Web Search Args
|
|
933
1483
|
// -----------------------------------------------------------------------------
|
|
934
1484
|
/**
|
|
935
|
-
*
|
|
1485
|
+
* Defines configuration arguments for the web search tool.
|
|
1486
|
+
*
|
|
1487
|
+
* **When to use**
|
|
1488
|
+
*
|
|
1489
|
+
* Use when you need to configure `WebSearch_20250305` with search limits,
|
|
1490
|
+
* domain filters, or user location.
|
|
1491
|
+
*
|
|
1492
|
+
* **Details**
|
|
1493
|
+
*
|
|
1494
|
+
* The payload can set `maxUses`, `allowedDomains`, `blockedDomains`, and
|
|
1495
|
+
* `userLocation`.
|
|
1496
|
+
*
|
|
1497
|
+
* **Gotchas**
|
|
1498
|
+
*
|
|
1499
|
+
* `allowedDomains` and `blockedDomains` are mutually exclusive.
|
|
1500
|
+
*
|
|
1501
|
+
* @see {@link WebSearch_20250305} for the provider-defined tool that consumes these arguments
|
|
1502
|
+
* @see {@link WebSearchUserLocation} for localizing search results
|
|
936
1503
|
*
|
|
937
|
-
* @since 1.0.0
|
|
938
1504
|
* @category Web Search
|
|
1505
|
+
* @since 4.0.0
|
|
939
1506
|
*/
|
|
940
1507
|
export const WebSearch_20250305_Args = /*#__PURE__*/Schema.Struct({
|
|
941
1508
|
/**
|
|
@@ -963,10 +1530,17 @@ export const WebSearch_20250305_Args = /*#__PURE__*/Schema.Struct({
|
|
|
963
1530
|
// Web Search Parameters
|
|
964
1531
|
// -----------------------------------------------------------------------------
|
|
965
1532
|
/**
|
|
966
|
-
*
|
|
1533
|
+
* Schema for Claude-supplied web search tool parameters.
|
|
1534
|
+
*
|
|
1535
|
+
* **Details**
|
|
1536
|
+
*
|
|
1537
|
+
* The payload contains the generated `query` string and is consumed by
|
|
1538
|
+
* `WebSearch_20250305`.
|
|
1539
|
+
*
|
|
1540
|
+
* @see {@link WebSearch_20250305} for the provider-defined tool that consumes this payload
|
|
967
1541
|
*
|
|
968
|
-
* @since 1.0.0
|
|
969
1542
|
* @category Web Search
|
|
1543
|
+
* @since 4.0.0
|
|
970
1544
|
*/
|
|
971
1545
|
export const WebSearchParameters = /*#__PURE__*/Schema.Struct({
|
|
972
1546
|
/**
|
|
@@ -978,15 +1552,22 @@ export const WebSearchParameters = /*#__PURE__*/Schema.Struct({
|
|
|
978
1552
|
// Web Search Tool Definitions
|
|
979
1553
|
// -----------------------------------------------------------------------------
|
|
980
1554
|
/**
|
|
981
|
-
*
|
|
1555
|
+
* Defines the web search tool for Claude models.
|
|
1556
|
+
*
|
|
1557
|
+
* **When to use**
|
|
1558
|
+
*
|
|
1559
|
+
* Use when you want Claude to search the web for real-time information.
|
|
1560
|
+
*
|
|
1561
|
+
* **Details**
|
|
982
1562
|
*
|
|
983
1563
|
* Enables Claude to search the web for real-time information. This is a
|
|
984
1564
|
* server-side tool executed by Anthropic's infrastructure.
|
|
985
|
-
*
|
|
986
1565
|
* Generally available (no beta header required).
|
|
987
1566
|
*
|
|
988
|
-
* @
|
|
1567
|
+
* @see {@link WebFetch_20250910} for retrieving known URLs after discovery
|
|
1568
|
+
*
|
|
989
1569
|
* @category Web Search
|
|
1570
|
+
* @since 4.0.0
|
|
990
1571
|
*/
|
|
991
1572
|
export const WebSearch_20250305 = /*#__PURE__*/Tool.providerDefined({
|
|
992
1573
|
id: "anthropic.web_search_20250305",
|
|
@@ -1004,10 +1585,21 @@ export const WebSearch_20250305 = /*#__PURE__*/Tool.providerDefined({
|
|
|
1004
1585
|
// Web Fetch Types
|
|
1005
1586
|
// -----------------------------------------------------------------------------
|
|
1006
1587
|
/**
|
|
1007
|
-
*
|
|
1588
|
+
* Defines citation configuration for web fetch.
|
|
1589
|
+
*
|
|
1590
|
+
* **When to use**
|
|
1591
|
+
*
|
|
1592
|
+
* Use when you need to enable or disable citations on web fetch results.
|
|
1593
|
+
*
|
|
1594
|
+
* **Details**
|
|
1595
|
+
*
|
|
1596
|
+
* The payload contains the `enabled` flag. `citations` is optional on
|
|
1597
|
+
* `WebFetch_20250910_Args`, and citations are disabled by default.
|
|
1598
|
+
*
|
|
1599
|
+
* @see {@link WebFetch_20250910_Args} for the argument schema that consumes this configuration
|
|
1008
1600
|
*
|
|
1009
|
-
* @since 1.0.0
|
|
1010
1601
|
* @category Web Fetch
|
|
1602
|
+
* @since 4.0.0
|
|
1011
1603
|
*/
|
|
1012
1604
|
export const WebFetchCitationsConfig = /*#__PURE__*/Schema.Struct({
|
|
1013
1605
|
/**
|
|
@@ -1019,10 +1611,29 @@ export const WebFetchCitationsConfig = /*#__PURE__*/Schema.Struct({
|
|
|
1019
1611
|
// Web Fetch Args
|
|
1020
1612
|
// -----------------------------------------------------------------------------
|
|
1021
1613
|
/**
|
|
1022
|
-
*
|
|
1614
|
+
* Defines configuration arguments for the web fetch tool.
|
|
1615
|
+
*
|
|
1616
|
+
* **When to use**
|
|
1617
|
+
*
|
|
1618
|
+
* Use when you need to configure `WebFetch_20250910` with usage limits, domain
|
|
1619
|
+
* filters, citations, or content token limits.
|
|
1620
|
+
*
|
|
1621
|
+
* **Details**
|
|
1622
|
+
*
|
|
1623
|
+
* The payload can set `maxUses`, domain filters, `citations`, and
|
|
1624
|
+
* `maxContentTokens`, which map to Anthropic web fetch request fields.
|
|
1625
|
+
*
|
|
1626
|
+
* **Gotchas**
|
|
1627
|
+
*
|
|
1628
|
+
* `allowedDomains` and `blockedDomains` are mutually exclusive.
|
|
1629
|
+
* `maxContentTokens` is approximate and does not apply to binary content such
|
|
1630
|
+
* as PDFs.
|
|
1631
|
+
*
|
|
1632
|
+
* @see {@link WebFetch_20250910} for the provider-defined tool that consumes these arguments
|
|
1633
|
+
* @see {@link WebFetchCitationsConfig} for configuring citations
|
|
1023
1634
|
*
|
|
1024
|
-
* @since 1.0.0
|
|
1025
1635
|
* @category Web Fetch
|
|
1636
|
+
* @since 4.0.0
|
|
1026
1637
|
*/
|
|
1027
1638
|
export const WebFetch_20250910_Args = /*#__PURE__*/Schema.Struct({
|
|
1028
1639
|
/**
|
|
@@ -1054,10 +1665,26 @@ export const WebFetch_20250910_Args = /*#__PURE__*/Schema.Struct({
|
|
|
1054
1665
|
// Web Fetch Parameters
|
|
1055
1666
|
// -----------------------------------------------------------------------------
|
|
1056
1667
|
/**
|
|
1057
|
-
*
|
|
1668
|
+
* Schema for Claude-supplied web fetch parameters.
|
|
1669
|
+
*
|
|
1670
|
+
* **When to use**
|
|
1671
|
+
*
|
|
1672
|
+
* Use when validating or constructing the `url` payload consumed by
|
|
1673
|
+
* `WebFetch_20250910`.
|
|
1674
|
+
*
|
|
1675
|
+
* **Details**
|
|
1676
|
+
*
|
|
1677
|
+
* The payload contains the single `url` parameter for Anthropic web fetch.
|
|
1678
|
+
*
|
|
1679
|
+
* **Gotchas**
|
|
1680
|
+
*
|
|
1681
|
+
* The URL must be user-provided or from prior search/fetch results. Maximum URL
|
|
1682
|
+
* length is 250 characters.
|
|
1683
|
+
*
|
|
1684
|
+
* @see {@link WebFetch_20250910} for the provider-defined tool that consumes this payload
|
|
1058
1685
|
*
|
|
1059
|
-
* @since 1.0.0
|
|
1060
1686
|
* @category Web Fetch
|
|
1687
|
+
* @since 4.0.0
|
|
1061
1688
|
*/
|
|
1062
1689
|
export const WebFetchParameters = /*#__PURE__*/Schema.Struct({
|
|
1063
1690
|
/**
|
|
@@ -1070,15 +1697,23 @@ export const WebFetchParameters = /*#__PURE__*/Schema.Struct({
|
|
|
1070
1697
|
// Web Fetch Tool Definitions
|
|
1071
1698
|
// -----------------------------------------------------------------------------
|
|
1072
1699
|
/**
|
|
1073
|
-
*
|
|
1700
|
+
* Defines the web fetch tool for Claude models.
|
|
1701
|
+
*
|
|
1702
|
+
* **When to use**
|
|
1703
|
+
*
|
|
1704
|
+
* Use when you want Claude to retrieve the content of a specific web page or
|
|
1705
|
+
* PDF.
|
|
1706
|
+
*
|
|
1707
|
+
* **Details**
|
|
1074
1708
|
*
|
|
1075
1709
|
* Allows Claude to retrieve full content from web pages and PDF documents.
|
|
1076
|
-
* This is a server-side tool executed by Anthropic's infrastructure.
|
|
1710
|
+
* This is a server-side tool executed by Anthropic's infrastructure. Selecting
|
|
1711
|
+
* this tool adds the "web-fetch-2025-09-10" beta header.
|
|
1077
1712
|
*
|
|
1078
|
-
*
|
|
1713
|
+
* @see {@link WebSearch_20250305} for discovering URLs before fetching specific content
|
|
1079
1714
|
*
|
|
1080
|
-
* @since 1.0.0
|
|
1081
1715
|
* @category Web Fetch
|
|
1716
|
+
* @since 4.0.0
|
|
1082
1717
|
*/
|
|
1083
1718
|
export const WebFetch_20250910 = /*#__PURE__*/Tool.providerDefined({
|
|
1084
1719
|
id: "anthropic.web_fetch_20250910",
|
|
@@ -1096,13 +1731,15 @@ export const WebFetch_20250910 = /*#__PURE__*/Tool.providerDefined({
|
|
|
1096
1731
|
// Tool Search Parameters
|
|
1097
1732
|
// -----------------------------------------------------------------------------
|
|
1098
1733
|
/**
|
|
1099
|
-
*
|
|
1734
|
+
* Schema for regex-based tool search input parameters.
|
|
1735
|
+
*
|
|
1736
|
+
* **Details**
|
|
1100
1737
|
*
|
|
1101
1738
|
* Claude constructs regex patterns using Python's `re.search()` syntax.
|
|
1102
1739
|
* Maximum query length: 200 characters.
|
|
1103
1740
|
*
|
|
1104
|
-
* @
|
|
1105
|
-
* @
|
|
1741
|
+
* @category tool search
|
|
1742
|
+
* @since 4.0.0
|
|
1106
1743
|
*/
|
|
1107
1744
|
export const ToolSearchRegexParameters = /*#__PURE__*/Schema.Struct({
|
|
1108
1745
|
/**
|
|
@@ -1111,10 +1748,22 @@ export const ToolSearchRegexParameters = /*#__PURE__*/Schema.Struct({
|
|
|
1111
1748
|
query: Schema.String
|
|
1112
1749
|
});
|
|
1113
1750
|
/**
|
|
1114
|
-
*
|
|
1751
|
+
* Defines input parameters for BM25/natural language tool search.
|
|
1752
|
+
*
|
|
1753
|
+
* **When to use**
|
|
1754
|
+
*
|
|
1755
|
+
* Use when validating or constructing the natural-language query payload for
|
|
1756
|
+
* `ToolSearchBM25_20251119`.
|
|
1757
|
+
*
|
|
1758
|
+
* **Details**
|
|
1759
|
+
*
|
|
1760
|
+
* The payload contains Claude's natural-language `query`. BM25 searches tool
|
|
1761
|
+
* names, descriptions, argument names, and argument descriptions.
|
|
1115
1762
|
*
|
|
1116
|
-
* @
|
|
1117
|
-
*
|
|
1763
|
+
* @see {@link ToolSearchBM25_20251119} for the provider-defined tool that consumes these parameters
|
|
1764
|
+
*
|
|
1765
|
+
* @category tool search
|
|
1766
|
+
* @since 4.0.0
|
|
1118
1767
|
*/
|
|
1119
1768
|
export const ToolSearchBM25Parameters = /*#__PURE__*/Schema.Struct({
|
|
1120
1769
|
/**
|
|
@@ -1126,16 +1775,17 @@ export const ToolSearchBM25Parameters = /*#__PURE__*/Schema.Struct({
|
|
|
1126
1775
|
// Tool Search Tool Definitions
|
|
1127
1776
|
// -----------------------------------------------------------------------------
|
|
1128
1777
|
/**
|
|
1129
|
-
*
|
|
1778
|
+
* Defines regex-based tool search for Claude models.
|
|
1779
|
+
*
|
|
1780
|
+
* **Details**
|
|
1130
1781
|
*
|
|
1131
1782
|
* Claude constructs regex patterns using Python's `re.search()` syntax to
|
|
1132
1783
|
* find tools. The regex is matched against tool names, descriptions,
|
|
1133
1784
|
* argument names, and argument descriptions.
|
|
1134
|
-
*
|
|
1135
1785
|
* Requires the "advanced-tool-use-2025-11-20" beta header.
|
|
1136
1786
|
*
|
|
1137
|
-
* @
|
|
1138
|
-
* @
|
|
1787
|
+
* @category tool search
|
|
1788
|
+
* @since 4.0.0
|
|
1139
1789
|
*/
|
|
1140
1790
|
export const ToolSearchRegex_20251119 = /*#__PURE__*/Tool.providerDefined({
|
|
1141
1791
|
id: "anthropic.tool_search_tool_regex_20251119",
|
|
@@ -1146,16 +1796,24 @@ export const ToolSearchRegex_20251119 = /*#__PURE__*/Tool.providerDefined({
|
|
|
1146
1796
|
failure: Generated.BetaResponseToolSearchToolResultError
|
|
1147
1797
|
});
|
|
1148
1798
|
/**
|
|
1149
|
-
* BM25/natural language tool search for Claude models.
|
|
1799
|
+
* Defines BM25/natural language tool search for Claude models.
|
|
1800
|
+
*
|
|
1801
|
+
* **When to use**
|
|
1802
|
+
*
|
|
1803
|
+
* Use when you want Claude to find relevant tools from a natural-language query
|
|
1804
|
+
* instead of a regex pattern.
|
|
1805
|
+
*
|
|
1806
|
+
* **Details**
|
|
1150
1807
|
*
|
|
1151
1808
|
* Claude uses natural language queries to search for tools using the
|
|
1152
1809
|
* BM25 algorithm. The search is performed against tool names, descriptions,
|
|
1153
1810
|
* argument names, and argument descriptions.
|
|
1154
|
-
*
|
|
1155
1811
|
* Requires the "advanced-tool-use-2025-11-20" beta header.
|
|
1156
1812
|
*
|
|
1157
|
-
* @
|
|
1158
|
-
*
|
|
1813
|
+
* @see {@link ToolSearchRegex_20251119} for the regex-pattern alternative
|
|
1814
|
+
*
|
|
1815
|
+
* @category tool search
|
|
1816
|
+
* @since 4.0.0
|
|
1159
1817
|
*/
|
|
1160
1818
|
export const ToolSearchBM25_20251119 = /*#__PURE__*/Tool.providerDefined({
|
|
1161
1819
|
id: "anthropic.tool_search_tool_bm25_20251119",
|