@fairyhunter13/ai-anthropic 3.0.58-fork.1

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.
Files changed (53) hide show
  1. package/CHANGELOG.md +2521 -0
  2. package/LICENSE +13 -0
  3. package/README.md +43 -0
  4. package/dist/index.d.mts +1099 -0
  5. package/dist/index.d.ts +1099 -0
  6. package/dist/index.js +5222 -0
  7. package/dist/index.js.map +1 -0
  8. package/dist/index.mjs +5298 -0
  9. package/dist/index.mjs.map +1 -0
  10. package/dist/internal/index.d.mts +960 -0
  11. package/dist/internal/index.d.ts +960 -0
  12. package/dist/internal/index.js +5122 -0
  13. package/dist/internal/index.js.map +1 -0
  14. package/dist/internal/index.mjs +5190 -0
  15. package/dist/internal/index.mjs.map +1 -0
  16. package/docs/05-anthropic.mdx +1321 -0
  17. package/internal.d.ts +1 -0
  18. package/package.json +83 -0
  19. package/src/anthropic-error.ts +26 -0
  20. package/src/anthropic-message-metadata.ts +143 -0
  21. package/src/anthropic-messages-api.ts +1348 -0
  22. package/src/anthropic-messages-language-model.ts +2407 -0
  23. package/src/anthropic-messages-options.ts +267 -0
  24. package/src/anthropic-prepare-tools.ts +404 -0
  25. package/src/anthropic-provider.ts +177 -0
  26. package/src/anthropic-tools.ts +238 -0
  27. package/src/convert-anthropic-messages-usage.ts +73 -0
  28. package/src/convert-to-anthropic-messages-prompt.ts +1144 -0
  29. package/src/forward-anthropic-container-id-from-last-step.ts +38 -0
  30. package/src/get-cache-control.ts +63 -0
  31. package/src/index.ts +17 -0
  32. package/src/internal/index.ts +4 -0
  33. package/src/map-anthropic-stop-reason.ts +30 -0
  34. package/src/tool/bash_20241022.ts +33 -0
  35. package/src/tool/bash_20250124.ts +33 -0
  36. package/src/tool/code-execution_20250522.ts +61 -0
  37. package/src/tool/code-execution_20250825.ts +281 -0
  38. package/src/tool/code-execution_20260120.ts +315 -0
  39. package/src/tool/computer_20241022.ts +87 -0
  40. package/src/tool/computer_20250124.ts +130 -0
  41. package/src/tool/computer_20251124.ts +151 -0
  42. package/src/tool/memory_20250818.ts +62 -0
  43. package/src/tool/text-editor_20241022.ts +69 -0
  44. package/src/tool/text-editor_20250124.ts +69 -0
  45. package/src/tool/text-editor_20250429.ts +70 -0
  46. package/src/tool/text-editor_20250728.ts +86 -0
  47. package/src/tool/tool-search-bm25_20251119.ts +99 -0
  48. package/src/tool/tool-search-regex_20251119.ts +111 -0
  49. package/src/tool/web-fetch-20250910.ts +145 -0
  50. package/src/tool/web-fetch-20260209.ts +145 -0
  51. package/src/tool/web-search_20250305.ts +136 -0
  52. package/src/tool/web-search_20260209.ts +136 -0
  53. package/src/version.ts +6 -0
@@ -0,0 +1,315 @@
1
+ import {
2
+ createProviderToolFactoryWithOutputSchema,
3
+ lazySchema,
4
+ zodSchema,
5
+ } from '@ai-sdk/provider-utils';
6
+ import { z } from 'zod/v4';
7
+
8
+ export const codeExecution_20260120OutputSchema = lazySchema(() =>
9
+ zodSchema(
10
+ z.discriminatedUnion('type', [
11
+ z.object({
12
+ type: z.literal('code_execution_result'),
13
+ stdout: z.string(),
14
+ stderr: z.string(),
15
+ return_code: z.number(),
16
+ content: z
17
+ .array(
18
+ z.object({
19
+ type: z.literal('code_execution_output'),
20
+ file_id: z.string(),
21
+ }),
22
+ )
23
+ .optional()
24
+ .default([]),
25
+ }),
26
+ z.object({
27
+ type: z.literal('encrypted_code_execution_result'),
28
+ encrypted_stdout: z.string(),
29
+ stderr: z.string(),
30
+ return_code: z.number(),
31
+ content: z
32
+ .array(
33
+ z.object({
34
+ type: z.literal('code_execution_output'),
35
+ file_id: z.string(),
36
+ }),
37
+ )
38
+ .optional()
39
+ .default([]),
40
+ }),
41
+ z.object({
42
+ type: z.literal('bash_code_execution_result'),
43
+ content: z.array(
44
+ z.object({
45
+ type: z.literal('bash_code_execution_output'),
46
+ file_id: z.string(),
47
+ }),
48
+ ),
49
+ stdout: z.string(),
50
+ stderr: z.string(),
51
+ return_code: z.number(),
52
+ }),
53
+ z.object({
54
+ type: z.literal('bash_code_execution_tool_result_error'),
55
+ error_code: z.string(),
56
+ }),
57
+ z.object({
58
+ type: z.literal('text_editor_code_execution_tool_result_error'),
59
+ error_code: z.string(),
60
+ }),
61
+ z.object({
62
+ type: z.literal('text_editor_code_execution_view_result'),
63
+ content: z.string(),
64
+ file_type: z.string(),
65
+ num_lines: z.number().nullable(),
66
+ start_line: z.number().nullable(),
67
+ total_lines: z.number().nullable(),
68
+ }),
69
+ z.object({
70
+ type: z.literal('text_editor_code_execution_create_result'),
71
+ is_file_update: z.boolean(),
72
+ }),
73
+ z.object({
74
+ type: z.literal('text_editor_code_execution_str_replace_result'),
75
+ lines: z.array(z.string()).nullable(),
76
+ new_lines: z.number().nullable(),
77
+ new_start: z.number().nullable(),
78
+ old_lines: z.number().nullable(),
79
+ old_start: z.number().nullable(),
80
+ }),
81
+ ]),
82
+ ),
83
+ );
84
+
85
+ export const codeExecution_20260120InputSchema = lazySchema(() =>
86
+ zodSchema(
87
+ z.discriminatedUnion('type', [
88
+ z.object({
89
+ type: z.literal('programmatic-tool-call'),
90
+ code: z.string(),
91
+ }),
92
+ z.object({
93
+ type: z.literal('bash_code_execution'),
94
+ command: z.string(),
95
+ }),
96
+ z.discriminatedUnion('command', [
97
+ z.object({
98
+ type: z.literal('text_editor_code_execution'),
99
+ command: z.literal('view'),
100
+ path: z.string(),
101
+ }),
102
+ z.object({
103
+ type: z.literal('text_editor_code_execution'),
104
+ command: z.literal('create'),
105
+ path: z.string(),
106
+ file_text: z.string().nullish(),
107
+ }),
108
+ z.object({
109
+ type: z.literal('text_editor_code_execution'),
110
+ command: z.literal('str_replace'),
111
+ path: z.string(),
112
+ old_str: z.string(),
113
+ new_str: z.string(),
114
+ }),
115
+ ]),
116
+ ]),
117
+ ),
118
+ );
119
+
120
+ const factory = createProviderToolFactoryWithOutputSchema<
121
+ | {
122
+ type: 'programmatic-tool-call';
123
+ /**
124
+ * Programmatic tool calling: Python code to execute when code_execution
125
+ * is used with allowedCallers to trigger client-executed tools.
126
+ */
127
+ code: string;
128
+ }
129
+ | {
130
+ type: 'bash_code_execution';
131
+
132
+ /**
133
+ * Shell command to execute.
134
+ */
135
+ command: string;
136
+ }
137
+ | {
138
+ type: 'text_editor_code_execution';
139
+ command: 'view';
140
+
141
+ /**
142
+ * The path to the file to view.
143
+ */
144
+ path: string;
145
+ }
146
+ | {
147
+ type: 'text_editor_code_execution';
148
+ command: 'create';
149
+
150
+ /**
151
+ * The path to the file to edit.
152
+ */
153
+ path: string;
154
+
155
+ /**
156
+ * The text of the file to edit.
157
+ */
158
+ file_text?: string | null;
159
+ }
160
+ | {
161
+ type: 'text_editor_code_execution';
162
+ command: 'str_replace';
163
+
164
+ /**
165
+ * The path to the file to edit.
166
+ */
167
+ path: string;
168
+
169
+ /**
170
+ * The string to replace.
171
+ */
172
+ old_str: string;
173
+
174
+ /**
175
+ * The new string to replace the old string with.
176
+ */
177
+ new_str: string;
178
+ },
179
+ | {
180
+ /**
181
+ * Programmatic tool calling result: returned when code_execution runs code
182
+ * that calls client-executed tools via allowedCallers.
183
+ */
184
+ type: 'code_execution_result';
185
+
186
+ /**
187
+ * Output from successful execution
188
+ */
189
+ stdout: string;
190
+
191
+ /**
192
+ * Error messages if execution fails
193
+ */
194
+ stderr: string;
195
+
196
+ /**
197
+ * 0 for success, non-zero for failure
198
+ */
199
+ return_code: number;
200
+
201
+ /**
202
+ * Output file Id list
203
+ */
204
+ content: Array<{ type: 'code_execution_output'; file_id: string }>;
205
+ }
206
+ | {
207
+ type: 'encrypted_code_execution_result';
208
+
209
+ /**
210
+ * Encrypted output from successful execution
211
+ */
212
+ encrypted_stdout: string;
213
+
214
+ /**
215
+ * Error messages if execution fails
216
+ */
217
+ stderr: string;
218
+
219
+ /**
220
+ * 0 for success, non-zero for failure
221
+ */
222
+ return_code: number;
223
+
224
+ /**
225
+ * Output file Id list
226
+ */
227
+ content: Array<{ type: 'code_execution_output'; file_id: string }>;
228
+ }
229
+ | {
230
+ type: 'bash_code_execution_result';
231
+
232
+ /**
233
+ * Output file Id list
234
+ */
235
+ content: Array<{
236
+ type: 'bash_code_execution_output';
237
+ file_id: string;
238
+ }>;
239
+
240
+ /**
241
+ * Output from successful execution
242
+ */
243
+ stdout: string;
244
+
245
+ /**
246
+ * Error messages if execution fails
247
+ */
248
+ stderr: string;
249
+
250
+ /**
251
+ * 0 for success, non-zero for failure
252
+ */
253
+ return_code: number;
254
+ }
255
+ | {
256
+ type: 'bash_code_execution_tool_result_error';
257
+
258
+ /**
259
+ * Available options: invalid_tool_input, unavailable, too_many_requests,
260
+ * execution_time_exceeded, output_file_too_large.
261
+ */
262
+ error_code: string;
263
+ }
264
+ | {
265
+ type: 'text_editor_code_execution_tool_result_error';
266
+
267
+ /**
268
+ * Available options: invalid_tool_input, unavailable, too_many_requests,
269
+ * execution_time_exceeded, file_not_found.
270
+ */
271
+ error_code: string;
272
+ }
273
+ | {
274
+ type: 'text_editor_code_execution_view_result';
275
+
276
+ content: string;
277
+
278
+ /**
279
+ * The type of the file. Available options: text, image, pdf.
280
+ */
281
+ file_type: string;
282
+
283
+ num_lines: number | null;
284
+ start_line: number | null;
285
+ total_lines: number | null;
286
+ }
287
+ | {
288
+ type: 'text_editor_code_execution_create_result';
289
+
290
+ is_file_update: boolean;
291
+ }
292
+ | {
293
+ type: 'text_editor_code_execution_str_replace_result';
294
+
295
+ lines: string[] | null;
296
+ new_lines: number | null;
297
+ new_start: number | null;
298
+ old_lines: number | null;
299
+ old_start: number | null;
300
+ },
301
+ {
302
+ // no arguments
303
+ }
304
+ >({
305
+ id: 'anthropic.code_execution_20260120',
306
+ inputSchema: codeExecution_20260120InputSchema,
307
+ outputSchema: codeExecution_20260120OutputSchema,
308
+ supportsDeferredResults: true,
309
+ });
310
+
311
+ export const codeExecution_20260120 = (
312
+ args: Parameters<typeof factory>[0] = {},
313
+ ) => {
314
+ return factory(args);
315
+ };
@@ -0,0 +1,87 @@
1
+ import {
2
+ createProviderToolFactory,
3
+ lazySchema,
4
+ zodSchema,
5
+ } from '@ai-sdk/provider-utils';
6
+ import { z } from 'zod/v4';
7
+
8
+ const computer_20241022InputSchema = lazySchema(() =>
9
+ zodSchema(
10
+ z.object({
11
+ action: z.enum([
12
+ 'key',
13
+ 'type',
14
+ 'mouse_move',
15
+ 'left_click',
16
+ 'left_click_drag',
17
+ 'right_click',
18
+ 'middle_click',
19
+ 'double_click',
20
+ 'screenshot',
21
+ 'cursor_position',
22
+ ]),
23
+ coordinate: z.array(z.number().int()).optional(),
24
+ text: z.string().optional(),
25
+ }),
26
+ ),
27
+ );
28
+
29
+ export const computer_20241022 = createProviderToolFactory<
30
+ {
31
+ /**
32
+ * The action to perform. The available actions are:
33
+ * - `key`: Press a key or key-combination on the keyboard.
34
+ * - This supports xdotool's `key` syntax.
35
+ * - Examples: "a", "Return", "alt+Tab", "ctrl+s", "Up", "KP_0" (for the numpad 0 key).
36
+ * - `type`: Type a string of text on the keyboard.
37
+ * - `cursor_position`: Get the current (x, y) pixel coordinate of the cursor on the screen.
38
+ * - `mouse_move`: Move the cursor to a specified (x, y) pixel coordinate on the screen.
39
+ * - `left_click`: Click the left mouse button.
40
+ * - `left_click_drag`: Click and drag the cursor to a specified (x, y) pixel coordinate on the screen.
41
+ * - `right_click`: Click the right mouse button.
42
+ * - `middle_click`: Click the middle mouse button.
43
+ * - `double_click`: Double-click the left mouse button.
44
+ * - `screenshot`: Take a screenshot of the screen.
45
+ */
46
+ action:
47
+ | 'key'
48
+ | 'type'
49
+ | 'mouse_move'
50
+ | 'left_click'
51
+ | 'left_click_drag'
52
+ | 'right_click'
53
+ | 'middle_click'
54
+ | 'double_click'
55
+ | 'screenshot'
56
+ | 'cursor_position';
57
+
58
+ /**
59
+ * (x, y): The x (pixels from the left edge) and y (pixels from the top edge) coordinates to move the mouse to. Required only by `action=mouse_move` and `action=left_click_drag`.
60
+ */
61
+ coordinate?: number[];
62
+
63
+ /**
64
+ * Required only by `action=type` and `action=key`.
65
+ */
66
+ text?: string;
67
+ },
68
+ {
69
+ /**
70
+ * The width of the display being controlled by the model in pixels.
71
+ */
72
+ displayWidthPx: number;
73
+
74
+ /**
75
+ * The height of the display being controlled by the model in pixels.
76
+ */
77
+ displayHeightPx: number;
78
+
79
+ /**
80
+ * The display number to control (only relevant for X11 environments). If specified, the tool will be provided a display number in the tool definition.
81
+ */
82
+ displayNumber?: number;
83
+ }
84
+ >({
85
+ id: 'anthropic.computer_20241022',
86
+ inputSchema: computer_20241022InputSchema,
87
+ });
@@ -0,0 +1,130 @@
1
+ import {
2
+ createProviderToolFactory,
3
+ lazySchema,
4
+ zodSchema,
5
+ } from '@ai-sdk/provider-utils';
6
+ import { z } from 'zod/v4';
7
+
8
+ const computer_20250124InputSchema = lazySchema(() =>
9
+ zodSchema(
10
+ z.object({
11
+ action: z.enum([
12
+ 'key',
13
+ 'hold_key',
14
+ 'type',
15
+ 'cursor_position',
16
+ 'mouse_move',
17
+ 'left_mouse_down',
18
+ 'left_mouse_up',
19
+ 'left_click',
20
+ 'left_click_drag',
21
+ 'right_click',
22
+ 'middle_click',
23
+ 'double_click',
24
+ 'triple_click',
25
+ 'scroll',
26
+ 'wait',
27
+ 'screenshot',
28
+ ]),
29
+ coordinate: z.tuple([z.number().int(), z.number().int()]).optional(),
30
+ duration: z.number().optional(),
31
+ scroll_amount: z.number().optional(),
32
+ scroll_direction: z.enum(['up', 'down', 'left', 'right']).optional(),
33
+ start_coordinate: z
34
+ .tuple([z.number().int(), z.number().int()])
35
+ .optional(),
36
+ text: z.string().optional(),
37
+ }),
38
+ ),
39
+ );
40
+
41
+ export const computer_20250124 = createProviderToolFactory<
42
+ {
43
+ /**
44
+ * - `key`: Press a key or key-combination on the keyboard.
45
+ * - This supports xdotool's `key` syntax.
46
+ * - Examples: "a", "Return", "alt+Tab", "ctrl+s", "Up", "KP_0" (for the numpad 0 key).
47
+ * - `hold_key`: Hold down a key or multiple keys for a specified duration (in seconds). Supports the same syntax as `key`.
48
+ * - `type`: Type a string of text on the keyboard.
49
+ * - `cursor_position`: Get the current (x, y) pixel coordinate of the cursor on the screen.
50
+ * - `mouse_move`: Move the cursor to a specified (x, y) pixel coordinate on the screen.
51
+ * - `left_mouse_down`: Press the left mouse button.
52
+ * - `left_mouse_up`: Release the left mouse button.
53
+ * - `left_click`: Click the left mouse button at the specified (x, y) pixel coordinate on the screen. You can also include a key combination to hold down while clicking using the `text` parameter.
54
+ * - `left_click_drag`: Click and drag the cursor from `start_coordinate` to a specified (x, y) pixel coordinate on the screen.
55
+ * - `right_click`: Click the right mouse button at the specified (x, y) pixel coordinate on the screen.
56
+ * - `middle_click`: Click the middle mouse button at the specified (x, y) pixel coordinate on the screen.
57
+ * - `double_click`: Double-click the left mouse button at the specified (x, y) pixel coordinate on the screen.
58
+ * - `triple_click`: Triple-click the left mouse button at the specified (x, y) pixel coordinate on the screen.
59
+ * - `scroll`: Scroll the screen in a specified direction by a specified amount of clicks of the scroll wheel, at the specified (x, y) pixel coordinate. DO NOT use PageUp/PageDown to scroll.
60
+ * - `wait`: Wait for a specified duration (in seconds).
61
+ * - `screenshot`: Take a screenshot of the screen.
62
+ */
63
+ action:
64
+ | 'key'
65
+ | 'hold_key'
66
+ | 'type'
67
+ | 'cursor_position'
68
+ | 'mouse_move'
69
+ | 'left_mouse_down'
70
+ | 'left_mouse_up'
71
+ | 'left_click'
72
+ | 'left_click_drag'
73
+ | 'right_click'
74
+ | 'middle_click'
75
+ | 'double_click'
76
+ | 'triple_click'
77
+ | 'scroll'
78
+ | 'wait'
79
+ | 'screenshot';
80
+
81
+ /**
82
+ * (x, y): The x (pixels from the left edge) and y (pixels from the top edge) coordinates to move the mouse to. Required only by `action=mouse_move` and `action=left_click_drag`.
83
+ */
84
+ coordinate?: [number, number];
85
+
86
+ /**
87
+ * The duration to hold the key down for. Required only by `action=hold_key` and `action=wait`.
88
+ */
89
+ duration?: number;
90
+
91
+ /**
92
+ * The number of 'clicks' to scroll. Required only by `action=scroll`.
93
+ */
94
+ scroll_amount?: number;
95
+
96
+ /**
97
+ * The direction to scroll the screen. Required only by `action=scroll`.
98
+ */
99
+ scroll_direction?: 'up' | 'down' | 'left' | 'right';
100
+
101
+ /**
102
+ * (x, y): The x (pixels from the left edge) and y (pixels from the top edge) coordinates to start the drag from. Required only by `action=left_click_drag`.
103
+ */
104
+ start_coordinate?: [number, number];
105
+
106
+ /**
107
+ * Required only by `action=type`, `action=key`, and `action=hold_key`. Can also be used by click or scroll actions to hold down keys while clicking or scrolling.
108
+ */
109
+ text?: string;
110
+ },
111
+ {
112
+ /**
113
+ * The width of the display being controlled by the model in pixels.
114
+ */
115
+ displayWidthPx: number;
116
+
117
+ /**
118
+ * The height of the display being controlled by the model in pixels.
119
+ */
120
+ displayHeightPx: number;
121
+
122
+ /**
123
+ * The display number to control (only relevant for X11 environments). If specified, the tool will be provided a display number in the tool definition.
124
+ */
125
+ displayNumber?: number;
126
+ }
127
+ >({
128
+ id: 'anthropic.computer_20250124',
129
+ inputSchema: computer_20250124InputSchema,
130
+ });
@@ -0,0 +1,151 @@
1
+ import {
2
+ createProviderToolFactory,
3
+ lazySchema,
4
+ zodSchema,
5
+ } from '@ai-sdk/provider-utils';
6
+ import { z } from 'zod/v4';
7
+
8
+ const computer_20251124InputSchema = lazySchema(() =>
9
+ zodSchema(
10
+ z.object({
11
+ action: z.enum([
12
+ 'key',
13
+ 'hold_key',
14
+ 'type',
15
+ 'cursor_position',
16
+ 'mouse_move',
17
+ 'left_mouse_down',
18
+ 'left_mouse_up',
19
+ 'left_click',
20
+ 'left_click_drag',
21
+ 'right_click',
22
+ 'middle_click',
23
+ 'double_click',
24
+ 'triple_click',
25
+ 'scroll',
26
+ 'wait',
27
+ 'screenshot',
28
+ 'zoom',
29
+ ]),
30
+ coordinate: z.tuple([z.number().int(), z.number().int()]).optional(),
31
+ duration: z.number().optional(),
32
+ region: z
33
+ .tuple([
34
+ z.number().int(),
35
+ z.number().int(),
36
+ z.number().int(),
37
+ z.number().int(),
38
+ ])
39
+ .optional(),
40
+ scroll_amount: z.number().optional(),
41
+ scroll_direction: z.enum(['up', 'down', 'left', 'right']).optional(),
42
+ start_coordinate: z
43
+ .tuple([z.number().int(), z.number().int()])
44
+ .optional(),
45
+ text: z.string().optional(),
46
+ }),
47
+ ),
48
+ );
49
+
50
+ export const computer_20251124 = createProviderToolFactory<
51
+ {
52
+ /**
53
+ * - `key`: Press a key or key-combination on the keyboard.
54
+ * - This supports xdotool's `key` syntax.
55
+ * - Examples: "a", "Return", "alt+Tab", "ctrl+s", "Up", "KP_0" (for the numpad 0 key).
56
+ * - `hold_key`: Hold down a key or multiple keys for a specified duration (in seconds). Supports the same syntax as `key`.
57
+ * - `type`: Type a string of text on the keyboard.
58
+ * - `cursor_position`: Get the current (x, y) pixel coordinate of the cursor on the screen.
59
+ * - `mouse_move`: Move the cursor to a specified (x, y) pixel coordinate on the screen.
60
+ * - `left_mouse_down`: Press the left mouse button.
61
+ * - `left_mouse_up`: Release the left mouse button.
62
+ * - `left_click`: Click the left mouse button at the specified (x, y) pixel coordinate on the screen. You can also include a key combination to hold down while clicking using the `text` parameter.
63
+ * - `left_click_drag`: Click and drag the cursor from `start_coordinate` to a specified (x, y) pixel coordinate on the screen.
64
+ * - `right_click`: Click the right mouse button at the specified (x, y) pixel coordinate on the screen.
65
+ * - `middle_click`: Click the middle mouse button at the specified (x, y) pixel coordinate on the screen.
66
+ * - `double_click`: Double-click the left mouse button at the specified (x, y) pixel coordinate on the screen.
67
+ * - `triple_click`: Triple-click the left mouse button at the specified (x, y) pixel coordinate on the screen.
68
+ * - `scroll`: Scroll the screen in a specified direction by a specified amount of clicks of the scroll wheel, at the specified (x, y) pixel coordinate. DO NOT use PageUp/PageDown to scroll.
69
+ * - `wait`: Wait for a specified duration (in seconds).
70
+ * - `screenshot`: Take a screenshot of the screen.
71
+ * - `zoom`: View a specific region of the screen at full resolution. Requires `enableZoom: true` in tool definition. Takes a `region` parameter with coordinates `[x1, y1, x2, y2]` defining top-left and bottom-right corners of the area to inspect.
72
+ */
73
+ action:
74
+ | 'key'
75
+ | 'hold_key'
76
+ | 'type'
77
+ | 'cursor_position'
78
+ | 'mouse_move'
79
+ | 'left_mouse_down'
80
+ | 'left_mouse_up'
81
+ | 'left_click'
82
+ | 'left_click_drag'
83
+ | 'right_click'
84
+ | 'middle_click'
85
+ | 'double_click'
86
+ | 'triple_click'
87
+ | 'scroll'
88
+ | 'wait'
89
+ | 'screenshot'
90
+ | 'zoom';
91
+
92
+ /**
93
+ * (x, y): The x (pixels from the left edge) and y (pixels from the top edge) coordinates to move the mouse to. Required only by `action=mouse_move` and `action=left_click_drag`.
94
+ */
95
+ coordinate?: [number, number];
96
+
97
+ /**
98
+ * The duration to hold the key down for. Required only by `action=hold_key` and `action=wait`.
99
+ */
100
+ duration?: number;
101
+
102
+ /**
103
+ * [x1, y1, x2, y2]: The coordinates defining the region to zoom into. x1, y1 is the top-left corner and x2, y2 is the bottom-right corner. Required only by `action=zoom`.
104
+ */
105
+ region?: [number, number, number, number];
106
+
107
+ /**
108
+ * The number of 'clicks' to scroll. Required only by `action=scroll`.
109
+ */
110
+ scroll_amount?: number;
111
+
112
+ /**
113
+ * The direction to scroll the screen. Required only by `action=scroll`.
114
+ */
115
+ scroll_direction?: 'up' | 'down' | 'left' | 'right';
116
+
117
+ /**
118
+ * (x, y): The x (pixels from the left edge) and y (pixels from the top edge) coordinates to start the drag from. Required only by `action=left_click_drag`.
119
+ */
120
+ start_coordinate?: [number, number];
121
+
122
+ /**
123
+ * Required only by `action=type`, `action=key`, and `action=hold_key`. Can also be used by click or scroll actions to hold down keys while clicking or scrolling.
124
+ */
125
+ text?: string;
126
+ },
127
+ {
128
+ /**
129
+ * The width of the display being controlled by the model in pixels.
130
+ */
131
+ displayWidthPx: number;
132
+
133
+ /**
134
+ * The height of the display being controlled by the model in pixels.
135
+ */
136
+ displayHeightPx: number;
137
+
138
+ /**
139
+ * The display number to control (only relevant for X11 environments). If specified, the tool will be provided a display number in the tool definition.
140
+ */
141
+ displayNumber?: number;
142
+
143
+ /**
144
+ * Enable zoom action. Set to true to allow Claude to zoom into specific screen regions. Default: false.
145
+ */
146
+ enableZoom?: boolean;
147
+ }
148
+ >({
149
+ id: 'anthropic.computer_20251124',
150
+ inputSchema: computer_20251124InputSchema,
151
+ });