@ai-sdk/anthropic 3.0.139 → 3.0.142

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.
@@ -115,6 +115,15 @@ The following optional provider options are available for Anthropic models:
115
115
 
116
116
  When set to `true`, the model will only call one tool at a time instead of potentially calling multiple tools in parallel.
117
117
 
118
+ - `allowInlineToolDefinitions` _boolean_
119
+
120
+ Optional. Defaults to `false`. Set this request-level option to `true` only
121
+ when system messages containing by-value `toolChanges` are controlled by your
122
+ server. Inline definitions can introduce tools or replace their restrictions.
123
+ Message-level provider options and UI `providerMetadata` cannot enable it.
124
+ Without this opt-in, emitted by-value definitions are rejected before sending
125
+ the request, including with default or automatic tool choice.
126
+
118
127
  - `sendReasoning` _boolean_
119
128
 
120
129
  Optional. Include reasoning content in requests sent to the model. Defaults to `true`.
@@ -189,8 +198,8 @@ const result = streamText({
189
198
  });
190
199
  ```
191
200
 
192
- For `claude-sonnet-5-5`, `claude-opus-5-5`, and `claude-fable-5-1`, the
193
- default `"auto"` mode uses native structured outputs through
201
+ For `claude-sonnet-5-5`, `claude-opus-5-5`, `claude-fable-5-1`, and
202
+ `claude-fable-5-2`, the default `"auto"` mode uses native structured outputs through
194
203
  `output_config.format`. These models reject forced tool use, so the
195
204
  `"jsonTool"` mode cannot be used with them. If you
196
205
  request `"jsonTool"` anyway, the provider falls back to `"outputFormat"` and
@@ -225,7 +234,7 @@ returned. Text before a tool call is still dropped.
225
234
 
226
235
  ### Effort
227
236
 
228
- Anthropic introduced an `effort` option with `claude-opus-4-5` that affects thinking, text responses, and function calls. Effort defaults to `high` and you can set it to `medium` or `low` to save tokens and to lower time-to-last-token latency (TTLT). `claude-opus-4-7`, `claude-opus-4-8`, `claude-opus-5`, `claude-opus-5-5`, `claude-fable-5`, `claude-fable-5-1`, `claude-sonnet-5`, `claude-sonnet-5-5`, and `claude-haiku-5-5` additionally support `xhigh` for maximum reasoning effort.
237
+ Anthropic introduced an `effort` option with `claude-opus-4-5` that affects thinking, text responses, and function calls. Effort defaults to `high` and you can set it to `medium` or `low` to save tokens and to lower time-to-last-token latency (TTLT). `claude-opus-4-7`, `claude-opus-4-8`, `claude-opus-5`, `claude-opus-5-5`, `claude-fable-5`, `claude-fable-5-1`, `claude-fable-5-2`, `claude-sonnet-5`, `claude-sonnet-5-5`, and `claude-haiku-5-5` additionally support `xhigh` for maximum reasoning effort.
229
238
 
230
239
  On `claude-opus-5` and `claude-haiku-5-5`, thinking can only be disabled at effort levels up to and including `high`. When you combine `thinking: { type: 'disabled' }` with `effort: 'xhigh'` or `effort: 'max'`, the AI SDK lowers the effort to `high` and emits a warning instead of sending a request that the API would reject.
231
240
 
@@ -238,6 +247,13 @@ thinks. Unlike `claude-sonnet-5-5`, thinking can still be turned off with
238
247
  Start at `medium` effort and test other levels rather than carrying over the
239
248
  settings you used on `claude-haiku-4-5`.
240
249
 
250
+ On `claude-fable-5-2`, thinking is always adaptive and cannot be disabled. It
251
+ supports `low`, `medium`, `high` (the API default), `xhigh`, and `max` effort.
252
+ The `medium` and `xhigh` levels behave differently than on `claude-fable-5-1`,
253
+ so start at `high` and re-test `medium` and your current setting rather than
254
+ carrying over the effort you tuned for `claude-fable-5-1`. Reserve `xhigh` for
255
+ the hardest long-running work where you have measured a gain.
256
+
241
257
  On `claude-opus-5-5`, thinking is always adaptive and cannot be disabled, so
242
258
  `effort` is the main control for latency and cost. The API default effort for
243
259
  `claude-opus-5-5` is `medium`. Start there and test other levels rather than
@@ -531,8 +547,8 @@ const { text } = await generateText({
531
547
 
532
548
  ##### Adaptive-Only Models
533
549
 
534
- `claude-sonnet-5-5`, `claude-opus-5-5`, `claude-fable-5`, and
535
- `claude-fable-5-1` always run adaptive thinking. The API rejects
550
+ `claude-sonnet-5-5`, `claude-opus-5-5`, `claude-fable-5`, `claude-fable-5-1`,
551
+ and `claude-fable-5-2` always run adaptive thinking. The API rejects
536
552
  `thinking: { type: 'disabled' }` and budget-based
537
553
  `thinking: { type: 'enabled' }` for these models. To keep existing code
538
554
  working, the provider:
@@ -632,8 +648,8 @@ console.log(text);
632
648
 
633
649
  ##### Thinking Updates
634
650
 
635
- Use `display: 'updates'` with `claude-sonnet-5-5`, `claude-opus-5-5`, or
636
- `claude-fable-5-1` to stream thinking summaries between tool calls. These models
651
+ Use `display: 'updates'` with `claude-sonnet-5-5`, `claude-opus-5-5`,
652
+ `claude-fable-5-1`, or `claude-fable-5-2` to stream thinking summaries between tool calls. These models
637
653
  return progress notes between tool calls as thinking blocks rather than text, so
638
654
  without this setting a long tool-calling turn can look silent. The provider adds
639
655
  the required `thinking-display-updates-2026-08-18` beta header automatically:
@@ -661,7 +677,28 @@ const result = streamText({
661
677
 
662
678
  ##### Thinking Block Binding
663
679
 
664
- Fable 5.1, Opus 5.5, and Sonnet 5.5 can recover from a thinking-block prefix
680
+ Fable 5.2, Fable 5.1, Opus 5.5, and Sonnet 5.5 use preserved thinking. Each
681
+ thinking block from an earlier assistant turn is bound to the request content
682
+ before it: the system prompt, the tools, and the earlier messages. If that
683
+ content changes between requests, the thinking blocks after the change become
684
+ invalid. By default, the API then rejects the request with a 400 error ("The
685
+ block is bound to a different conversation"). Keep the message history
686
+ append-only, and keep the system prompt and tools stable, where you can.
687
+
688
+ This also applies inside a single multi-step `generateText` or `streamText`
689
+ call. When `prepareStep` returns a different `system`, `activeTools`, or
690
+ `messages` for a later step, the thinking from the earlier steps is sent with
691
+ the changed content, and the next step fails. Editing or removing earlier
692
+ messages between turns, or changing the system prompt or tools between turns,
693
+ has the same effect.
694
+
695
+ If your application changes this content, set
696
+ `blockBinding.prefixMismatchBehavior` to `drop_block` (see below). The API then
697
+ drops the invalid thinking blocks instead of rejecting the request. The model
698
+ thinks again for the dropped context, which can increase output token usage, so
699
+ measure token usage on your own workloads before you rely on it.
700
+
701
+ Fable 5.2, Fable 5.1, Opus 5.5, and Sonnet 5.5 can recover from a thinking-block prefix
665
702
  mismatch by dropping the mismatched block. Set
666
703
  `blockBinding.prefixMismatchBehavior` to `drop_block`, or set it to `error` to
667
704
  reject the request. You can provide block binding by itself to preserve the
@@ -1193,7 +1230,7 @@ const computerTool = anthropic.tools.computer_20251124({
1193
1230
 
1194
1231
  <Note>
1195
1232
  Use `computerToolset_20260801` for Claude Sonnet 5.5 and Opus 5.5 (required),
1196
- Opus 5, Sonnet 5, Fable 5, Fable 5.1, and Opus 4.8. Use `computer_20251124`
1233
+ Opus 5, Sonnet 5, Fable 5, Fable 5.1, Fable 5.2, and Opus 4.8. Use `computer_20251124`
1197
1234
  for Claude Opus 4.5 through Opus 4.7, which support the zoom action. Use
1198
1235
  `computer_20250124` for Claude Sonnet 4.5, Haiku 4.5, Opus 4.1, Sonnet 4, Opus
1199
1236
  4, and Sonnet 3.7.
@@ -1211,7 +1248,13 @@ return several actions in one turn, each as its own tool call.
1211
1248
  The API returns each action as a separate `tool_use` block with
1212
1249
  `toolset_name: 'computer'`. The AI SDK maps every action to the toolset tool and
1213
1250
  passes the action name as `action`, so `execute` receives the same input shape
1214
- as the older computer tools:
1251
+ as the older computer tools.
1252
+
1253
+ The SDK preserves the returned member name as `action` and rejects disabled or
1254
+ unavailable members before emitting tool calls, including during streaming.
1255
+ Disabled members are also rejected by the tool's local input schema.
1256
+
1257
+ For example:
1215
1258
 
1216
1259
  ```ts
1217
1260
  const computerTool = anthropic.tools.computerToolset_20260801({
@@ -1531,8 +1574,8 @@ This sends `tool_reference` blocks to Anthropic, which loads the corresponding d
1531
1574
 
1532
1575
  ### Mid-Conversation System Controls
1533
1576
 
1534
- With `claude-sonnet-5-5`, `claude-opus-5-5`, and `claude-fable-5-1`, use an
1535
- empty system message to change effort from the next user turn. A separate
1577
+ With `claude-sonnet-5-5`, `claude-opus-5-5`, `claude-fable-5-1`, and
1578
+ `claude-fable-5-2`, use an empty system message to change effort from the next user turn. A separate
1536
1579
  system message containing text can provide a turn-scoped reminder with
1537
1580
  `clearAt: 'next_user_message'`: its text applies until the next user message. Keep the reminder after a user turn and
1538
1581
  before an assistant turn, or at the end of the messages array.
@@ -1653,7 +1696,7 @@ const result = await generateText({
1653
1696
 
1654
1697
  #### Defining Tools by Value
1655
1698
 
1656
- A `tool_addition` can also define the tool by value with `tool`, in the same shape as an entry of the `tools` option. The tool does not need to be declared in `tools` up front, which lets you introduce tools that did not exist when the conversation started, for example after an MCP server connects. Defining a tool under an existing name replaces the earlier definition from that point on, so this also changes a tool's schema mid-conversation. The required `inline-tools-2026-09-15` beta header is added automatically.
1699
+ For server-controlled messages, a `tool_addition` can also define the tool by value with `tool`, in the same shape as an entry of the `tools` option. The tool does not need to be declared in `tools` up front, which lets you introduce tools that did not exist when the conversation started, for example after an MCP server connects. Defining a tool under an existing name replaces the earlier definition from that point on, so this also changes a tool's schema mid-conversation. The required `inline-tools-2026-09-15` beta header is added automatically.
1657
1700
 
1658
1701
  ```ts
1659
1702
  import { anthropic } from '@ai-sdk/anthropic';
@@ -1663,6 +1706,9 @@ const result = await generateText({
1663
1706
  model: anthropic('claude-opus-4-8'),
1664
1707
  // required for system messages inside `messages`:
1665
1708
  allowSystemInMessages: true,
1709
+ providerOptions: {
1710
+ anthropic: { allowInlineToolDefinitions: true },
1711
+ },
1666
1712
  messages: [
1667
1713
  { role: 'user', content: 'What is the weather forecast for Paris?' },
1668
1714
  {
@@ -1692,6 +1738,16 @@ const result = await generateText({
1692
1738
  });
1693
1739
  ```
1694
1740
 
1741
+ <Note>
1742
+ By-value definitions require the request-level
1743
+ `providerOptions.anthropic.allowInlineToolDefinitions: true` opt-in. Enable it
1744
+ only for server-controlled messages, since it permits new tools and
1745
+ replacements independently of `tools` and `activeTools`. For client UI history,
1746
+ keep the default and declare tools on the server, adding them by reference
1747
+ with `toolName`. Setting this option on a message does not grant trust.
1748
+ Existing tool-choice restrictions still apply after opting in.
1749
+ </Note>
1750
+
1695
1751
  <Note>
1696
1752
  A tool defined by value is only known to the model. It is not part of the
1697
1753
  `tools` option, so functions like `generateText` cannot execute its calls. Use
@@ -2107,6 +2163,7 @@ and the `mediaType` should be set to `'application/pdf'`.
2107
2163
 
2108
2164
  | Model | Image Input | Object Generation | Tool Usage | Computer Use | Web Search | Tool Search | Compaction |
2109
2165
  | ------------------- | ------------------- | ------------------- | ------------------- | ------------------- | ------------------- | ------------------- | ------------------- |
2166
+ | `claude-fable-5-2` | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> |
2110
2167
  | `claude-fable-5-1` | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> |
2111
2168
  | `claude-opus-5-5` | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> |
2112
2169
  | `claude-opus-5` | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-sdk/anthropic",
3
- "version": "3.0.139",
3
+ "version": "3.0.142",
4
4
  "license": "Apache-2.0",
5
5
  "sideEffects": false,
6
6
  "main": "./dist/index.js",
@@ -37,7 +37,7 @@
37
37
  },
38
38
  "dependencies": {
39
39
  "@ai-sdk/provider": "3.0.19",
40
- "@ai-sdk/provider-utils": "4.0.64"
40
+ "@ai-sdk/provider-utils": "4.0.66"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@types/node": "20.17.24",
@@ -66,6 +66,33 @@ import { CacheControlValidator } from './get-cache-control';
66
66
  import { mapAnthropicStopReason } from './map-anthropic-stop-reason';
67
67
  import { sanitizeJsonSchema } from './sanitize-json-schema';
68
68
  import { supportsNativeStructuredOutputSchema } from './supports-native-structured-output-schema';
69
+ import { computerToolset_20260801Members } from './tool/computer-toolset_20260801';
70
+
71
+ function validateToolsetMember({
72
+ toolsetName,
73
+ memberName,
74
+ tools,
75
+ }: {
76
+ toolsetName: string;
77
+ memberName: string;
78
+ tools: AnthropicTool[] | undefined;
79
+ }): void {
80
+ const toolset = tools?.find(
81
+ tool => 'type' in tool && tool.type === 'computer_toolset_20260801',
82
+ );
83
+
84
+ if (
85
+ toolsetName !== 'computer' ||
86
+ toolset == null ||
87
+ !computerToolset_20260801Members.some(member => member === memberName) ||
88
+ toolset.configs?.[memberName]?.enabled === false
89
+ ) {
90
+ throw new InvalidResponseDataError({
91
+ data: { toolsetName, memberName },
92
+ message: `Received an unavailable toolset member: ${toolsetName}.${memberName}.`,
93
+ });
94
+ }
95
+ }
69
96
 
70
97
  function createCitationSource(
71
98
  citation: Citation,
@@ -178,11 +205,16 @@ function toToolsetMemberInput({
178
205
  memberName: string;
179
206
  input: unknown;
180
207
  }): JSONObject {
208
+ if (typeof input !== 'object' || input === null || Array.isArray(input)) {
209
+ throw new InvalidResponseDataError({
210
+ data: input,
211
+ message: 'Invalid toolset member input: expected an object.',
212
+ });
213
+ }
214
+
181
215
  return {
216
+ ...(input as JSONObject),
182
217
  action: memberName,
183
- ...(typeof input === 'object' && input !== null && !Array.isArray(input)
184
- ? (input as JSONObject)
185
- : {}),
186
218
  };
187
219
  }
188
220
 
@@ -622,6 +654,32 @@ export class AnthropicMessagesLanguageModel implements LanguageModelV3 {
622
654
  },
623
655
  });
624
656
 
657
+ // Initial system tool changes are ignored by the prompt converter.
658
+ // Validate only definitions that remain in the outgoing messages.
659
+ const emittedInlineDefinitions = new Set(
660
+ messagesPrompt.messages.flatMap(message =>
661
+ message.role === 'system'
662
+ ? message.content.flatMap(part =>
663
+ part.type === 'tool_addition' &&
664
+ part.tool.type === 'tool_definition'
665
+ ? [part.tool.definition]
666
+ : [],
667
+ )
668
+ : [],
669
+ ),
670
+ );
671
+ if (
672
+ emittedInlineDefinitions.size > 0 &&
673
+ anthropicOptions?.allowInlineToolDefinitions !== true
674
+ ) {
675
+ throw new InvalidArgumentError({
676
+ argument: 'providerOptions.anthropic.allowInlineToolDefinitions',
677
+ message:
678
+ 'Inline tool definitions require providerOptions.anthropic.allowInlineToolDefinitions to be true. ' +
679
+ 'Enable this option only for server-controlled messages, or declare tools in the tools option and add them by reference with toolName.',
680
+ });
681
+ }
682
+
625
683
  // Some models always run adaptive thinking and reject `disabled` thinking
626
684
  // with a 400. Drop the unsupported setting and keep the request adaptive
627
685
  // so it still succeeds.
@@ -1108,27 +1166,20 @@ export class AnthropicMessagesLanguageModel implements LanguageModelV3 {
1108
1166
  );
1109
1167
 
1110
1168
  // Forced-choice and JSON-tool fallbacks restrict the declared tools.
1111
- // Inline definitions, including those replayed from history, must not
1112
- // restore other tools before the provider executes the request.
1169
+ // MCP connectors and inline definitions, including those replayed from
1170
+ // history, must not restore other tools before the provider executes the request.
1113
1171
  if (
1114
1172
  (toolChoice?.type === 'tool' &&
1115
1173
  (anthropicToolChoice?.type === 'auto' || jsonResponseTool != null)) ||
1116
1174
  (toolChoice?.type === 'none' && jsonResponseTool != null)
1117
1175
  ) {
1118
- // Initial system tool changes are ignored by the prompt converter.
1119
- // Validate only definitions that remain in the outgoing messages.
1120
- const emittedInlineDefinitions = new Set(
1121
- messagesPrompt.messages.flatMap(message =>
1122
- message.role === 'system'
1123
- ? message.content.flatMap(part =>
1124
- part.type === 'tool_addition' &&
1125
- part.tool.type === 'tool_definition'
1126
- ? [part.tool.definition]
1127
- : [],
1128
- )
1129
- : [],
1130
- ),
1131
- );
1176
+ for (const server of baseArgs.mcp_servers ?? []) {
1177
+ server.tool_configuration = {
1178
+ allowed_tools: server.tool_configuration?.allowed_tools,
1179
+ enabled: false,
1180
+ };
1181
+ }
1182
+
1132
1183
  const selectedSdkName =
1133
1184
  toolChoice.type === 'tool' ? toolChoice.toolName : undefined;
1134
1185
  const selectedTool = tools?.find(tool => tool.name === selectedSdkName);
@@ -1423,6 +1474,11 @@ export class AnthropicMessagesLanguageModel implements LanguageModelV3 {
1423
1474
  text: JSON.stringify(part.input),
1424
1475
  });
1425
1476
  } else if (part.toolset_name != null) {
1477
+ validateToolsetMember({
1478
+ toolsetName: part.toolset_name,
1479
+ memberName: part.name,
1480
+ tools: args.tools,
1481
+ });
1426
1482
  // toolset member calls (e.g. the computer toolset) are mapped to
1427
1483
  // the toolset tool with the member name as the `action`:
1428
1484
  content.push({
@@ -2152,6 +2208,11 @@ export class AnthropicMessagesLanguageModel implements LanguageModelV3 {
2152
2208
  id: String(value.index),
2153
2209
  });
2154
2210
  } else if (part.toolset_name != null) {
2211
+ validateToolsetMember({
2212
+ toolsetName: part.toolset_name,
2213
+ memberName: part.name,
2214
+ tools: body.tools,
2215
+ });
2155
2216
  const callerInfo = getAnthropicCallerInfo(part.caller);
2156
2217
  const customToolName = toolNameMapping.toCustomToolName(
2157
2218
  part.toolset_name,
@@ -2664,19 +2725,18 @@ export class AnthropicMessagesLanguageModel implements LanguageModelV3 {
2664
2725
  ? {}
2665
2726
  : secureJsonParse(contentBlock.input);
2666
2727
  } catch {
2667
- // ignore parse errors, fall back to the raw input
2668
- memberInput = undefined;
2728
+ throw new InvalidResponseDataError({
2729
+ data: contentBlock.input,
2730
+ message: 'Invalid toolset member input JSON.',
2731
+ });
2669
2732
  }
2670
2733
 
2671
- contentBlock.input =
2672
- memberInput === undefined
2673
- ? contentBlock.input
2674
- : JSON.stringify(
2675
- toToolsetMemberInput({
2676
- memberName: contentBlock.toolset.memberName,
2677
- input: memberInput,
2678
- }),
2679
- );
2734
+ contentBlock.input = JSON.stringify(
2735
+ toToolsetMemberInput({
2736
+ memberName: contentBlock.toolset.memberName,
2737
+ input: memberInput,
2738
+ }),
2739
+ );
2680
2740
 
2681
2741
  controller.enqueue({
2682
2742
  type: 'tool-input-delta',
@@ -3306,7 +3366,10 @@ export function getModelCapabilities(modelId: string): {
3306
3366
  supportsBetweenToolsThinking: false,
3307
3367
  isKnownModel: true,
3308
3368
  };
3309
- } else if (modelId.includes('claude-fable-5-1')) {
3369
+ } else if (
3370
+ modelId.includes('claude-fable-5-2') ||
3371
+ modelId.includes('claude-fable-5-1')
3372
+ ) {
3310
3373
  return {
3311
3374
  maxOutputTokens: 128000,
3312
3375
  supportsStructuredOutput: true,
@@ -29,6 +29,7 @@ export type AnthropicMessagesModelId =
29
29
  | 'claude-opus-5-5'
30
30
  | 'claude-fable-5'
31
31
  | 'claude-fable-5-1'
32
+ | 'claude-fable-5-2'
32
33
  | 'claude-sonnet-5'
33
34
  | 'claude-sonnet-5-5'
34
35
  | (string & {});
@@ -115,7 +116,8 @@ export const anthropicSystemMessageProviderOptions = lazySchema(() =>
115
116
  * an entry of the `tools` option. The tool does not need to be declared
116
117
  * in `tools`, and defining a tool under an existing name replaces it
117
118
  * from that point on. The required `inline-tools-2026-09-15` beta is
118
- * added automatically.
119
+ * added automatically. Requires the request-level
120
+ * `allowInlineToolDefinitions` option to be true.
119
121
  *
120
122
  * A `tool_removal` always references the tool by `toolName`.
121
123
  */
@@ -171,6 +173,14 @@ export const anthropicLanguageModelOptions = lazySchema(() => {
171
173
  */
172
174
  sendReasoning: z.boolean().optional(),
173
175
 
176
+ /**
177
+ * Allow tool definitions supplied by value in system-message tool changes.
178
+ * Defaults to false. Enable only for server-controlled messages: inline
179
+ * definitions can add tools or replace their configured restrictions.
180
+ * This request-level option cannot be enabled through message metadata.
181
+ */
182
+ allowInlineToolDefinitions: z.boolean().optional(),
183
+
174
184
  /**
175
185
  * Determines how structured outputs are generated.
176
186
  *
@@ -189,7 +199,7 @@ export const anthropicLanguageModelOptions = lazySchema(() => {
189
199
  * Requires a minimum budget of 1,024 tokens and counts towards the `max_tokens` limit.
190
200
  *
191
201
  * Models that always use adaptive thinking (e.g. `claude-opus-5-5`,
192
- * `claude-fable-5-1`) reject `enabled` and `disabled`. For those models the
202
+ * `claude-fable-5-1`, `claude-fable-5-2`) reject `enabled` and `disabled`. For those models the
193
203
  * provider drops the unsupported setting, emits a warning, and sends an
194
204
  * adaptive thinking request. Use `effort` to control how much they think.
195
205
  *
@@ -33,30 +33,39 @@ export const computerToolset_20260801Members = [
33
33
  export type ComputerToolset_20260801Member =
34
34
  (typeof computerToolset_20260801Members)[number];
35
35
 
36
- const computerToolset_20260801InputSchema = lazySchema(() =>
37
- zodSchema(
38
- z.object({
39
- action: z.enum(computerToolset_20260801Members),
40
- coordinate: z.tuple([z.number().int(), z.number().int()]).optional(),
41
- duration: z.number().optional(),
42
- region: z
43
- .tuple([
44
- z.number().int(),
45
- z.number().int(),
46
- z.number().int(),
47
- z.number().int(),
48
- ])
49
- .optional(),
50
- repeat: z.number().int().optional(),
51
- scroll_amount: z.number().optional(),
52
- scroll_direction: z.enum(['up', 'down', 'left', 'right']).optional(),
53
- start_coordinate: z
54
- .tuple([z.number().int(), z.number().int()])
55
- .optional(),
56
- text: z.string().optional(),
57
- }),
58
- ),
59
- );
36
+ const computerToolset_20260801InputSchema = (
37
+ configs?: Partial<
38
+ Record<ComputerToolset_20260801Member, { enabled?: boolean }>
39
+ >,
40
+ ) =>
41
+ lazySchema(() =>
42
+ zodSchema(
43
+ z.object({
44
+ action: z.enum(
45
+ computerToolset_20260801Members.filter(
46
+ member => configs?.[member]?.enabled !== false,
47
+ ),
48
+ ),
49
+ coordinate: z.tuple([z.number().int(), z.number().int()]).optional(),
50
+ duration: z.number().optional(),
51
+ region: z
52
+ .tuple([
53
+ z.number().int(),
54
+ z.number().int(),
55
+ z.number().int(),
56
+ z.number().int(),
57
+ ])
58
+ .optional(),
59
+ repeat: z.number().int().optional(),
60
+ scroll_amount: z.number().optional(),
61
+ scroll_direction: z.enum(['up', 'down', 'left', 'right']).optional(),
62
+ start_coordinate: z
63
+ .tuple([z.number().int(), z.number().int()])
64
+ .optional(),
65
+ text: z.string().optional(),
66
+ }),
67
+ ),
68
+ );
60
69
 
61
70
  export const computerToolset_20260801ArgsSchema = lazySchema(() =>
62
71
  zodSchema(
@@ -74,7 +83,7 @@ export const computerToolset_20260801ArgsSchema = lazySchema(() =>
74
83
  ),
75
84
  );
76
85
 
77
- export const computerToolset_20260801 = createProviderToolFactory<
86
+ const factory = createProviderToolFactory<
78
87
  {
79
88
  /**
80
89
  * The member tool that Claude invoked. Each member is returned by the API
@@ -161,5 +170,10 @@ export const computerToolset_20260801 = createProviderToolFactory<
161
170
  }
162
171
  >({
163
172
  id: 'anthropic.computer_toolset_20260801',
164
- inputSchema: computerToolset_20260801InputSchema,
173
+ inputSchema: computerToolset_20260801InputSchema(),
174
+ });
175
+
176
+ export const computerToolset_20260801: typeof factory = args => ({
177
+ ...factory(args),
178
+ inputSchema: computerToolset_20260801InputSchema(args.configs),
165
179
  });