@anthropic-ai/sdk 0.70.1 → 0.71.0

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 (83) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/README.md +1 -1
  3. package/lib/tools/BetaToolRunner.d.mts +2 -0
  4. package/lib/tools/BetaToolRunner.d.mts.map +1 -1
  5. package/lib/tools/BetaToolRunner.d.ts +2 -0
  6. package/lib/tools/BetaToolRunner.d.ts.map +1 -1
  7. package/lib/tools/BetaToolRunner.js +88 -15
  8. package/lib/tools/BetaToolRunner.js.map +1 -1
  9. package/lib/tools/BetaToolRunner.mjs +88 -15
  10. package/lib/tools/BetaToolRunner.mjs.map +1 -1
  11. package/lib/tools/CompactionControl.d.mts +25 -0
  12. package/lib/tools/CompactionControl.d.mts.map +1 -0
  13. package/lib/tools/CompactionControl.d.ts +25 -0
  14. package/lib/tools/CompactionControl.d.ts.map +1 -0
  15. package/lib/tools/CompactionControl.js +28 -0
  16. package/lib/tools/CompactionControl.js.map +1 -0
  17. package/lib/tools/CompactionControl.mjs +25 -0
  18. package/lib/tools/CompactionControl.mjs.map +1 -0
  19. package/lib/tools/ToolRunner.js +1 -1
  20. package/lib/tools/ToolRunner.js.map +1 -1
  21. package/lib/tools/ToolRunner.mjs +1 -1
  22. package/lib/tools/ToolRunner.mjs.map +1 -1
  23. package/package.json +1 -1
  24. package/resources/beta/beta.d.mts +3 -3
  25. package/resources/beta/beta.d.mts.map +1 -1
  26. package/resources/beta/beta.d.ts +3 -3
  27. package/resources/beta/beta.d.ts.map +1 -1
  28. package/resources/beta/beta.js.map +1 -1
  29. package/resources/beta/beta.mjs.map +1 -1
  30. package/resources/beta/index.d.mts +1 -1
  31. package/resources/beta/index.d.mts.map +1 -1
  32. package/resources/beta/index.d.ts +1 -1
  33. package/resources/beta/index.d.ts.map +1 -1
  34. package/resources/beta/index.js.map +1 -1
  35. package/resources/beta/index.mjs.map +1 -1
  36. package/resources/beta/messages/batches.d.mts +288 -3
  37. package/resources/beta/messages/batches.d.mts.map +1 -1
  38. package/resources/beta/messages/batches.d.ts +288 -3
  39. package/resources/beta/messages/batches.d.ts.map +1 -1
  40. package/resources/beta/messages/batches.js.map +1 -1
  41. package/resources/beta/messages/batches.mjs.map +1 -1
  42. package/resources/beta/messages/index.d.mts +1 -1
  43. package/resources/beta/messages/index.d.mts.map +1 -1
  44. package/resources/beta/messages/index.d.ts +1 -1
  45. package/resources/beta/messages/index.d.ts.map +1 -1
  46. package/resources/beta/messages/index.js.map +1 -1
  47. package/resources/beta/messages/index.mjs.map +1 -1
  48. package/resources/beta/messages/messages.d.mts +344 -11
  49. package/resources/beta/messages/messages.d.mts.map +1 -1
  50. package/resources/beta/messages/messages.d.ts +344 -11
  51. package/resources/beta/messages/messages.d.ts.map +1 -1
  52. package/resources/beta/messages/messages.js +1 -1
  53. package/resources/beta/messages/messages.js.map +1 -1
  54. package/resources/beta/messages/messages.mjs +1 -1
  55. package/resources/beta/messages/messages.mjs.map +1 -1
  56. package/resources/completions.d.mts +1 -1
  57. package/resources/completions.d.ts +1 -1
  58. package/resources/messages/batches.d.mts +2 -2
  59. package/resources/messages/batches.d.ts +2 -2
  60. package/resources/messages/messages.d.mts +2 -2
  61. package/resources/messages/messages.d.mts.map +1 -1
  62. package/resources/messages/messages.d.ts +2 -2
  63. package/resources/messages/messages.d.ts.map +1 -1
  64. package/resources/messages/messages.js +1 -1
  65. package/resources/messages/messages.js.map +1 -1
  66. package/resources/messages/messages.mjs +1 -1
  67. package/resources/messages/messages.mjs.map +1 -1
  68. package/src/lib/tools/BetaToolRunner.ts +101 -15
  69. package/src/lib/tools/CompactionControl.ts +52 -0
  70. package/src/lib/tools/ToolRunner.ts +1 -1
  71. package/src/resources/beta/beta.ts +19 -2
  72. package/src/resources/beta/index.ts +18 -1
  73. package/src/resources/beta/messages/batches.ts +307 -3
  74. package/src/resources/beta/messages/index.ts +18 -1
  75. package/src/resources/beta/messages/messages.ts +462 -6
  76. package/src/resources/completions.ts +1 -1
  77. package/src/resources/messages/batches.ts +2 -2
  78. package/src/resources/messages/messages.ts +3 -1
  79. package/src/version.ts +1 -1
  80. package/version.d.mts +1 -1
  81. package/version.d.ts +1 -1
  82. package/version.js +1 -1
  83. package/version.mjs +1 -1
@@ -178,7 +178,7 @@ export class Messages extends APIResource {
178
178
  * const betaMessageTokensCount =
179
179
  * await client.beta.messages.countTokens({
180
180
  * messages: [{ content: 'string', role: 'user' }],
181
- * model: 'claude-sonnet-4-5',
181
+ * model: 'claude-opus-4-5-20251101',
182
182
  * });
183
183
  * ```
184
184
  */
@@ -625,11 +625,19 @@ export interface BetaCodeExecutionTool20250522 {
625
625
 
626
626
  type: 'code_execution_20250522';
627
627
 
628
+ allowed_callers?: Array<'direct' | 'code_execution_20250825'>;
629
+
628
630
  /**
629
631
  * Create a cache control breakpoint at this content block.
630
632
  */
631
633
  cache_control?: BetaCacheControlEphemeral | null;
632
634
 
635
+ /**
636
+ * If true, tool will not be included in initial system prompt. Only loaded when
637
+ * returned via tool_reference from tool search.
638
+ */
639
+ defer_loading?: boolean;
640
+
633
641
  strict?: boolean;
634
642
  }
635
643
 
@@ -643,11 +651,19 @@ export interface BetaCodeExecutionTool20250825 {
643
651
 
644
652
  type: 'code_execution_20250825';
645
653
 
654
+ allowed_callers?: Array<'direct' | 'code_execution_20250825'>;
655
+
646
656
  /**
647
657
  * Create a cache control breakpoint at this content block.
648
658
  */
649
659
  cache_control?: BetaCacheControlEphemeral | null;
650
660
 
661
+ /**
662
+ * If true, tool will not be included in initial system prompt. Only loaded when
663
+ * returned via tool_reference from tool search.
664
+ */
665
+ defer_loading?: boolean;
666
+
651
667
  strict?: boolean;
652
668
  }
653
669
 
@@ -772,6 +788,7 @@ export type BetaContentBlock =
772
788
  | BetaCodeExecutionToolResultBlock
773
789
  | BetaBashCodeExecutionToolResultBlock
774
790
  | BetaTextEditorCodeExecutionToolResultBlock
791
+ | BetaToolSearchToolResultBlock
775
792
  | BetaMCPToolUseBlock
776
793
  | BetaMCPToolResultBlock
777
794
  | BetaContainerUploadBlock;
@@ -794,6 +811,7 @@ export type BetaContentBlockParam =
794
811
  | BetaCodeExecutionToolResultBlockParam
795
812
  | BetaBashCodeExecutionToolResultBlockParam
796
813
  | BetaTextEditorCodeExecutionToolResultBlockParam
814
+ | BetaToolSearchToolResultBlockParam
797
815
  | BetaMCPToolUseBlockParam
798
816
  | BetaRequestMCPToolResultBlockParam
799
817
  | BetaContainerUploadBlockParam;
@@ -827,6 +845,13 @@ export interface BetaCountTokensContextManagementResponse {
827
845
  original_input_tokens: number;
828
846
  }
829
847
 
848
+ /**
849
+ * Tool invocation directly from the model.
850
+ */
851
+ export interface BetaDirectCaller {
852
+ type: 'direct';
853
+ }
854
+
830
855
  export interface BetaDocumentBlock {
831
856
  /**
832
857
  * Citation configuration for the document
@@ -893,6 +918,24 @@ export interface BetaJSONOutputFormat {
893
918
  type: 'json_schema';
894
919
  }
895
920
 
921
+ /**
922
+ * Configuration for a specific tool in an MCP toolset.
923
+ */
924
+ export interface BetaMCPToolConfig {
925
+ defer_loading?: boolean;
926
+
927
+ enabled?: boolean;
928
+ }
929
+
930
+ /**
931
+ * Default configuration for tools in an MCP toolset.
932
+ */
933
+ export interface BetaMCPToolDefaultConfig {
934
+ defer_loading?: boolean;
935
+
936
+ enabled?: boolean;
937
+ }
938
+
896
939
  export interface BetaMCPToolResultBlock {
897
940
  content: string | Array<BetaTextBlock>;
898
941
 
@@ -941,6 +984,36 @@ export interface BetaMCPToolUseBlockParam {
941
984
  cache_control?: BetaCacheControlEphemeral | null;
942
985
  }
943
986
 
987
+ /**
988
+ * Configuration for a group of tools from an MCP server.
989
+ *
990
+ * Allows configuring enabled status and defer_loading for all tools from an MCP
991
+ * server, with optional per-tool overrides.
992
+ */
993
+ export interface BetaMCPToolset {
994
+ /**
995
+ * Name of the MCP server to configure tools for
996
+ */
997
+ mcp_server_name: string;
998
+
999
+ type: 'mcp_toolset';
1000
+
1001
+ /**
1002
+ * Create a cache control breakpoint at this content block.
1003
+ */
1004
+ cache_control?: BetaCacheControlEphemeral | null;
1005
+
1006
+ /**
1007
+ * Configuration overrides for specific tools, keyed by tool name
1008
+ */
1009
+ configs?: { [key: string]: BetaMCPToolConfig } | null;
1010
+
1011
+ /**
1012
+ * Default configuration applied to all tools from this server
1013
+ */
1014
+ default_config?: BetaMCPToolDefaultConfig;
1015
+ }
1016
+
944
1017
  export interface BetaMemoryTool20250818 {
945
1018
  /**
946
1019
  * Name of the tool.
@@ -951,11 +1024,21 @@ export interface BetaMemoryTool20250818 {
951
1024
 
952
1025
  type: 'memory_20250818';
953
1026
 
1027
+ allowed_callers?: Array<'direct' | 'code_execution_20250825'>;
1028
+
954
1029
  /**
955
1030
  * Create a cache control breakpoint at this content block.
956
1031
  */
957
1032
  cache_control?: BetaCacheControlEphemeral | null;
958
1033
 
1034
+ /**
1035
+ * If true, tool will not be included in initial system prompt. Only loaded when
1036
+ * returned via tool_reference from tool search.
1037
+ */
1038
+ defer_loading?: boolean;
1039
+
1040
+ input_examples?: Array<{ [key: string]: unknown }>;
1041
+
959
1042
  strict?: boolean;
960
1043
  }
961
1044
 
@@ -1256,6 +1339,13 @@ export interface BetaMetadata {
1256
1339
  user_id?: string | null;
1257
1340
  }
1258
1341
 
1342
+ export interface BetaOutputConfig {
1343
+ /**
1344
+ * All possible effort levels.
1345
+ */
1346
+ effort?: 'low' | 'medium' | 'high' | null;
1347
+ }
1348
+
1259
1349
  export interface BetaPlainTextSource {
1260
1350
  data: string;
1261
1351
 
@@ -1294,6 +1384,7 @@ export interface BetaRawContentBlockStartEvent {
1294
1384
  | BetaCodeExecutionToolResultBlock
1295
1385
  | BetaBashCodeExecutionToolResultBlock
1296
1386
  | BetaTextEditorCodeExecutionToolResultBlock
1387
+ | BetaToolSearchToolResultBlock
1297
1388
  | BetaMCPToolUseBlock
1298
1389
  | BetaMCPToolResultBlock
1299
1390
  | BetaContainerUploadBlock;
@@ -1455,6 +1546,15 @@ export interface BetaSearchResultBlockParam {
1455
1546
  citations?: BetaCitationsConfigParam;
1456
1547
  }
1457
1548
 
1549
+ /**
1550
+ * Tool invocation generated by a server-side tool.
1551
+ */
1552
+ export interface BetaServerToolCaller {
1553
+ tool_id: string;
1554
+
1555
+ type: 'code_execution_20250825';
1556
+ }
1557
+
1458
1558
  export interface BetaServerToolUsage {
1459
1559
  /**
1460
1560
  * The number of web fetch tool requests.
@@ -1470,9 +1570,21 @@ export interface BetaServerToolUsage {
1470
1570
  export interface BetaServerToolUseBlock {
1471
1571
  id: string;
1472
1572
 
1473
- input: unknown;
1573
+ /**
1574
+ * Tool invocation directly from the model.
1575
+ */
1576
+ caller: BetaDirectCaller | BetaServerToolCaller;
1577
+
1578
+ input: { [key: string]: unknown };
1474
1579
 
1475
- name: 'web_search' | 'web_fetch' | 'code_execution' | 'bash_code_execution' | 'text_editor_code_execution';
1580
+ name:
1581
+ | 'web_search'
1582
+ | 'web_fetch'
1583
+ | 'code_execution'
1584
+ | 'bash_code_execution'
1585
+ | 'text_editor_code_execution'
1586
+ | 'tool_search_tool_regex'
1587
+ | 'tool_search_tool_bm25';
1476
1588
 
1477
1589
  type: 'server_tool_use';
1478
1590
  }
@@ -1482,7 +1594,14 @@ export interface BetaServerToolUseBlockParam {
1482
1594
 
1483
1595
  input: unknown;
1484
1596
 
1485
- name: 'web_search' | 'web_fetch' | 'code_execution' | 'bash_code_execution' | 'text_editor_code_execution';
1597
+ name:
1598
+ | 'web_search'
1599
+ | 'web_fetch'
1600
+ | 'code_execution'
1601
+ | 'bash_code_execution'
1602
+ | 'text_editor_code_execution'
1603
+ | 'tool_search_tool_regex'
1604
+ | 'tool_search_tool_bm25';
1486
1605
 
1487
1606
  type: 'server_tool_use';
1488
1607
 
@@ -1490,6 +1609,11 @@ export interface BetaServerToolUseBlockParam {
1490
1609
  * Create a cache control breakpoint at this content block.
1491
1610
  */
1492
1611
  cache_control?: BetaCacheControlEphemeral | null;
1612
+
1613
+ /**
1614
+ * Tool invocation directly from the model.
1615
+ */
1616
+ caller?: BetaDirectCaller | BetaServerToolCaller;
1493
1617
  }
1494
1618
 
1495
1619
  export interface BetaSignatureDelta {
@@ -1796,11 +1920,19 @@ export interface BetaTool {
1796
1920
  */
1797
1921
  name: string;
1798
1922
 
1923
+ allowed_callers?: Array<'direct' | 'code_execution_20250825'>;
1924
+
1799
1925
  /**
1800
1926
  * Create a cache control breakpoint at this content block.
1801
1927
  */
1802
1928
  cache_control?: BetaCacheControlEphemeral | null;
1803
1929
 
1930
+ /**
1931
+ * If true, tool will not be included in initial system prompt. Only loaded when
1932
+ * returned via tool_reference from tool search.
1933
+ */
1934
+ defer_loading?: boolean;
1935
+
1804
1936
  /**
1805
1937
  * Description of what this tool does.
1806
1938
  *
@@ -1811,6 +1943,8 @@ export interface BetaTool {
1811
1943
  */
1812
1944
  description?: string;
1813
1945
 
1946
+ input_examples?: Array<{ [key: string]: unknown }>;
1947
+
1814
1948
  strict?: boolean;
1815
1949
 
1816
1950
  type?: 'custom' | null;
@@ -1844,11 +1978,21 @@ export interface BetaToolBash20241022 {
1844
1978
 
1845
1979
  type: 'bash_20241022';
1846
1980
 
1981
+ allowed_callers?: Array<'direct' | 'code_execution_20250825'>;
1982
+
1847
1983
  /**
1848
1984
  * Create a cache control breakpoint at this content block.
1849
1985
  */
1850
1986
  cache_control?: BetaCacheControlEphemeral | null;
1851
1987
 
1988
+ /**
1989
+ * If true, tool will not be included in initial system prompt. Only loaded when
1990
+ * returned via tool_reference from tool search.
1991
+ */
1992
+ defer_loading?: boolean;
1993
+
1994
+ input_examples?: Array<{ [key: string]: unknown }>;
1995
+
1852
1996
  strict?: boolean;
1853
1997
  }
1854
1998
 
@@ -1862,11 +2006,21 @@ export interface BetaToolBash20250124 {
1862
2006
 
1863
2007
  type: 'bash_20250124';
1864
2008
 
2009
+ allowed_callers?: Array<'direct' | 'code_execution_20250825'>;
2010
+
1865
2011
  /**
1866
2012
  * Create a cache control breakpoint at this content block.
1867
2013
  */
1868
2014
  cache_control?: BetaCacheControlEphemeral | null;
1869
2015
 
2016
+ /**
2017
+ * If true, tool will not be included in initial system prompt. Only loaded when
2018
+ * returned via tool_reference from tool search.
2019
+ */
2020
+ defer_loading?: boolean;
2021
+
2022
+ input_examples?: Array<{ [key: string]: unknown }>;
2023
+
1870
2024
  strict?: boolean;
1871
2025
  }
1872
2026
 
@@ -1953,16 +2107,26 @@ export interface BetaToolComputerUse20241022 {
1953
2107
 
1954
2108
  type: 'computer_20241022';
1955
2109
 
2110
+ allowed_callers?: Array<'direct' | 'code_execution_20250825'>;
2111
+
1956
2112
  /**
1957
2113
  * Create a cache control breakpoint at this content block.
1958
2114
  */
1959
2115
  cache_control?: BetaCacheControlEphemeral | null;
1960
2116
 
2117
+ /**
2118
+ * If true, tool will not be included in initial system prompt. Only loaded when
2119
+ * returned via tool_reference from tool search.
2120
+ */
2121
+ defer_loading?: boolean;
2122
+
1961
2123
  /**
1962
2124
  * The X11 display number (e.g. 0, 1) for the display.
1963
2125
  */
1964
2126
  display_number?: number | null;
1965
2127
 
2128
+ input_examples?: Array<{ [key: string]: unknown }>;
2129
+
1966
2130
  strict?: boolean;
1967
2131
  }
1968
2132
 
@@ -1986,19 +2150,97 @@ export interface BetaToolComputerUse20250124 {
1986
2150
 
1987
2151
  type: 'computer_20250124';
1988
2152
 
2153
+ allowed_callers?: Array<'direct' | 'code_execution_20250825'>;
2154
+
1989
2155
  /**
1990
2156
  * Create a cache control breakpoint at this content block.
1991
2157
  */
1992
2158
  cache_control?: BetaCacheControlEphemeral | null;
1993
2159
 
2160
+ /**
2161
+ * If true, tool will not be included in initial system prompt. Only loaded when
2162
+ * returned via tool_reference from tool search.
2163
+ */
2164
+ defer_loading?: boolean;
2165
+
1994
2166
  /**
1995
2167
  * The X11 display number (e.g. 0, 1) for the display.
1996
2168
  */
1997
2169
  display_number?: number | null;
1998
2170
 
2171
+ input_examples?: Array<{ [key: string]: unknown }>;
2172
+
2173
+ strict?: boolean;
2174
+ }
2175
+
2176
+ export interface BetaToolComputerUse20251124 {
2177
+ /**
2178
+ * The height of the display in pixels.
2179
+ */
2180
+ display_height_px: number;
2181
+
2182
+ /**
2183
+ * The width of the display in pixels.
2184
+ */
2185
+ display_width_px: number;
2186
+
2187
+ /**
2188
+ * Name of the tool.
2189
+ *
2190
+ * This is how the tool will be called by the model and in `tool_use` blocks.
2191
+ */
2192
+ name: 'computer';
2193
+
2194
+ type: 'computer_20251124';
2195
+
2196
+ allowed_callers?: Array<'direct' | 'code_execution_20250825'>;
2197
+
2198
+ /**
2199
+ * Create a cache control breakpoint at this content block.
2200
+ */
2201
+ cache_control?: BetaCacheControlEphemeral | null;
2202
+
2203
+ /**
2204
+ * If true, tool will not be included in initial system prompt. Only loaded when
2205
+ * returned via tool_reference from tool search.
2206
+ */
2207
+ defer_loading?: boolean;
2208
+
2209
+ /**
2210
+ * The X11 display number (e.g. 0, 1) for the display.
2211
+ */
2212
+ display_number?: number | null;
2213
+
2214
+ /**
2215
+ * Whether to enable an action to take a zoomed-in screenshot of the screen.
2216
+ */
2217
+ enable_zoom?: boolean;
2218
+
2219
+ input_examples?: Array<{ [key: string]: unknown }>;
2220
+
1999
2221
  strict?: boolean;
2000
2222
  }
2001
2223
 
2224
+ export interface BetaToolReferenceBlock {
2225
+ tool_name: string;
2226
+
2227
+ type: 'tool_reference';
2228
+ }
2229
+
2230
+ /**
2231
+ * Tool reference block that can be included in tool_result content.
2232
+ */
2233
+ export interface BetaToolReferenceBlockParam {
2234
+ tool_name: string;
2235
+
2236
+ type: 'tool_reference';
2237
+
2238
+ /**
2239
+ * Create a cache control breakpoint at this content block.
2240
+ */
2241
+ cache_control?: BetaCacheControlEphemeral | null;
2242
+ }
2243
+
2002
2244
  export interface BetaToolResultBlockParam {
2003
2245
  tool_use_id: string;
2004
2246
 
@@ -2011,11 +2253,116 @@ export interface BetaToolResultBlockParam {
2011
2253
 
2012
2254
  content?:
2013
2255
  | string
2014
- | Array<BetaTextBlockParam | BetaImageBlockParam | BetaSearchResultBlockParam | BetaRequestDocumentBlock>;
2256
+ | Array<
2257
+ | BetaTextBlockParam
2258
+ | BetaImageBlockParam
2259
+ | BetaSearchResultBlockParam
2260
+ | BetaRequestDocumentBlock
2261
+ | BetaToolReferenceBlockParam
2262
+ >;
2015
2263
 
2016
2264
  is_error?: boolean;
2017
2265
  }
2018
2266
 
2267
+ export interface BetaToolSearchToolBm25_20251119 {
2268
+ /**
2269
+ * Name of the tool.
2270
+ *
2271
+ * This is how the tool will be called by the model and in `tool_use` blocks.
2272
+ */
2273
+ name: 'tool_search_tool_bm25';
2274
+
2275
+ type: 'tool_search_tool_bm25_20251119' | 'tool_search_tool_bm25';
2276
+
2277
+ allowed_callers?: Array<'direct' | 'code_execution_20250825'>;
2278
+
2279
+ /**
2280
+ * Create a cache control breakpoint at this content block.
2281
+ */
2282
+ cache_control?: BetaCacheControlEphemeral | null;
2283
+
2284
+ /**
2285
+ * If true, tool will not be included in initial system prompt. Only loaded when
2286
+ * returned via tool_reference from tool search.
2287
+ */
2288
+ defer_loading?: boolean;
2289
+
2290
+ strict?: boolean;
2291
+ }
2292
+
2293
+ export interface BetaToolSearchToolRegex20251119 {
2294
+ /**
2295
+ * Name of the tool.
2296
+ *
2297
+ * This is how the tool will be called by the model and in `tool_use` blocks.
2298
+ */
2299
+ name: 'tool_search_tool_regex';
2300
+
2301
+ type: 'tool_search_tool_regex_20251119' | 'tool_search_tool_regex';
2302
+
2303
+ allowed_callers?: Array<'direct' | 'code_execution_20250825'>;
2304
+
2305
+ /**
2306
+ * Create a cache control breakpoint at this content block.
2307
+ */
2308
+ cache_control?: BetaCacheControlEphemeral | null;
2309
+
2310
+ /**
2311
+ * If true, tool will not be included in initial system prompt. Only loaded when
2312
+ * returned via tool_reference from tool search.
2313
+ */
2314
+ defer_loading?: boolean;
2315
+
2316
+ strict?: boolean;
2317
+ }
2318
+
2319
+ export interface BetaToolSearchToolResultBlock {
2320
+ content: BetaToolSearchToolResultError | BetaToolSearchToolSearchResultBlock;
2321
+
2322
+ tool_use_id: string;
2323
+
2324
+ type: 'tool_search_tool_result';
2325
+ }
2326
+
2327
+ export interface BetaToolSearchToolResultBlockParam {
2328
+ content: BetaToolSearchToolResultErrorParam | BetaToolSearchToolSearchResultBlockParam;
2329
+
2330
+ tool_use_id: string;
2331
+
2332
+ type: 'tool_search_tool_result';
2333
+
2334
+ /**
2335
+ * Create a cache control breakpoint at this content block.
2336
+ */
2337
+ cache_control?: BetaCacheControlEphemeral | null;
2338
+ }
2339
+
2340
+ export interface BetaToolSearchToolResultError {
2341
+ error_code: 'invalid_tool_input' | 'unavailable' | 'too_many_requests' | 'execution_time_exceeded';
2342
+
2343
+ error_message: string | null;
2344
+
2345
+ type: 'tool_search_tool_result_error';
2346
+ }
2347
+
2348
+ export interface BetaToolSearchToolResultErrorParam {
2349
+ error_code: 'invalid_tool_input' | 'unavailable' | 'too_many_requests' | 'execution_time_exceeded';
2350
+
2351
+ type: 'tool_search_tool_result_error';
2352
+ }
2353
+
2354
+ export interface BetaToolSearchToolSearchResultBlock {
2355
+ tool_references: Array<BetaToolReferenceBlock>;
2356
+
2357
+ type: 'tool_search_tool_search_result';
2358
+ }
2359
+
2360
+ export interface BetaToolSearchToolSearchResultBlockParam {
2361
+ tool_references: Array<BetaToolReferenceBlockParam>;
2362
+
2363
+ type: 'tool_search_tool_search_result';
2364
+ }
2365
+
2019
2366
  export type BetaToolResultContentBlockParam = Extract<BetaToolResultBlockParam['content'], any[]>[number];
2020
2367
 
2021
2368
  export interface BetaToolTextEditor20241022 {
@@ -2028,11 +2375,21 @@ export interface BetaToolTextEditor20241022 {
2028
2375
 
2029
2376
  type: 'text_editor_20241022';
2030
2377
 
2378
+ allowed_callers?: Array<'direct' | 'code_execution_20250825'>;
2379
+
2031
2380
  /**
2032
2381
  * Create a cache control breakpoint at this content block.
2033
2382
  */
2034
2383
  cache_control?: BetaCacheControlEphemeral | null;
2035
2384
 
2385
+ /**
2386
+ * If true, tool will not be included in initial system prompt. Only loaded when
2387
+ * returned via tool_reference from tool search.
2388
+ */
2389
+ defer_loading?: boolean;
2390
+
2391
+ input_examples?: Array<{ [key: string]: unknown }>;
2392
+
2036
2393
  strict?: boolean;
2037
2394
  }
2038
2395
 
@@ -2046,11 +2403,21 @@ export interface BetaToolTextEditor20250124 {
2046
2403
 
2047
2404
  type: 'text_editor_20250124';
2048
2405
 
2406
+ allowed_callers?: Array<'direct' | 'code_execution_20250825'>;
2407
+
2049
2408
  /**
2050
2409
  * Create a cache control breakpoint at this content block.
2051
2410
  */
2052
2411
  cache_control?: BetaCacheControlEphemeral | null;
2053
2412
 
2413
+ /**
2414
+ * If true, tool will not be included in initial system prompt. Only loaded when
2415
+ * returned via tool_reference from tool search.
2416
+ */
2417
+ defer_loading?: boolean;
2418
+
2419
+ input_examples?: Array<{ [key: string]: unknown }>;
2420
+
2054
2421
  strict?: boolean;
2055
2422
  }
2056
2423
 
@@ -2064,11 +2431,21 @@ export interface BetaToolTextEditor20250429 {
2064
2431
 
2065
2432
  type: 'text_editor_20250429';
2066
2433
 
2434
+ allowed_callers?: Array<'direct' | 'code_execution_20250825'>;
2435
+
2067
2436
  /**
2068
2437
  * Create a cache control breakpoint at this content block.
2069
2438
  */
2070
2439
  cache_control?: BetaCacheControlEphemeral | null;
2071
2440
 
2441
+ /**
2442
+ * If true, tool will not be included in initial system prompt. Only loaded when
2443
+ * returned via tool_reference from tool search.
2444
+ */
2445
+ defer_loading?: boolean;
2446
+
2447
+ input_examples?: Array<{ [key: string]: unknown }>;
2448
+
2072
2449
  strict?: boolean;
2073
2450
  }
2074
2451
 
@@ -2082,11 +2459,21 @@ export interface BetaToolTextEditor20250728 {
2082
2459
 
2083
2460
  type: 'text_editor_20250728';
2084
2461
 
2462
+ allowed_callers?: Array<'direct' | 'code_execution_20250825'>;
2463
+
2085
2464
  /**
2086
2465
  * Create a cache control breakpoint at this content block.
2087
2466
  */
2088
2467
  cache_control?: BetaCacheControlEphemeral | null;
2089
2468
 
2469
+ /**
2470
+ * If true, tool will not be included in initial system prompt. Only loaded when
2471
+ * returned via tool_reference from tool search.
2472
+ */
2473
+ defer_loading?: boolean;
2474
+
2475
+ input_examples?: Array<{ [key: string]: unknown }>;
2476
+
2090
2477
  /**
2091
2478
  * Maximum number of characters to display when viewing a file. If not specified,
2092
2479
  * defaults to displaying the full file.
@@ -2096,6 +2483,12 @@ export interface BetaToolTextEditor20250728 {
2096
2483
  strict?: boolean;
2097
2484
  }
2098
2485
 
2486
+ /**
2487
+ * Configuration for a group of tools from an MCP server.
2488
+ *
2489
+ * Allows configuring enabled status and defer_loading for all tools from an MCP
2490
+ * server, with optional per-tool overrides.
2491
+ */
2099
2492
  export type BetaToolUnion =
2100
2493
  | BetaTool
2101
2494
  | BetaToolBash20241022
@@ -2106,11 +2499,15 @@ export type BetaToolUnion =
2106
2499
  | BetaMemoryTool20250818
2107
2500
  | BetaToolComputerUse20250124
2108
2501
  | BetaToolTextEditor20241022
2502
+ | BetaToolComputerUse20251124
2109
2503
  | BetaToolTextEditor20250124
2110
2504
  | BetaToolTextEditor20250429
2111
2505
  | BetaToolTextEditor20250728
2112
2506
  | BetaWebSearchTool20250305
2113
- | BetaWebFetchTool20250910;
2507
+ | BetaWebFetchTool20250910
2508
+ | BetaToolSearchToolBm25_20251119
2509
+ | BetaToolSearchToolRegex20251119
2510
+ | BetaMCPToolset;
2114
2511
 
2115
2512
  export interface BetaToolUseBlock {
2116
2513
  id: string;
@@ -2120,6 +2517,11 @@ export interface BetaToolUseBlock {
2120
2517
  name: string;
2121
2518
 
2122
2519
  type: 'tool_use';
2520
+
2521
+ /**
2522
+ * Tool invocation directly from the model.
2523
+ */
2524
+ caller?: BetaDirectCaller | BetaServerToolCaller;
2123
2525
  }
2124
2526
 
2125
2527
  export interface BetaToolUseBlockParam {
@@ -2135,6 +2537,11 @@ export interface BetaToolUseBlockParam {
2135
2537
  * Create a cache control breakpoint at this content block.
2136
2538
  */
2137
2539
  cache_control?: BetaCacheControlEphemeral | null;
2540
+
2541
+ /**
2542
+ * Tool invocation directly from the model.
2543
+ */
2544
+ caller?: BetaDirectCaller | BetaServerToolCaller;
2138
2545
  }
2139
2546
 
2140
2547
  export interface BetaToolUsesKeep {
@@ -2240,6 +2647,8 @@ export interface BetaWebFetchTool20250910 {
2240
2647
 
2241
2648
  type: 'web_fetch_20250910';
2242
2649
 
2650
+ allowed_callers?: Array<'direct' | 'code_execution_20250825'>;
2651
+
2243
2652
  /**
2244
2653
  * List of domains to allow fetching from
2245
2654
  */
@@ -2261,6 +2670,12 @@ export interface BetaWebFetchTool20250910 {
2261
2670
  */
2262
2671
  citations?: BetaCitationsConfigParam | null;
2263
2672
 
2673
+ /**
2674
+ * If true, tool will not be included in initial system prompt. Only loaded when
2675
+ * returned via tool_reference from tool search.
2676
+ */
2677
+ defer_loading?: boolean;
2678
+
2264
2679
  /**
2265
2680
  * Maximum number of tokens used by including web page text content in the context.
2266
2681
  * The limit is approximate and does not apply to binary content such as PDFs.
@@ -2352,6 +2767,8 @@ export interface BetaWebSearchTool20250305 {
2352
2767
 
2353
2768
  type: 'web_search_20250305';
2354
2769
 
2770
+ allowed_callers?: Array<'direct' | 'code_execution_20250825'>;
2771
+
2355
2772
  /**
2356
2773
  * If provided, only these domains will be included in results. Cannot be used
2357
2774
  * alongside `blocked_domains`.
@@ -2369,6 +2786,12 @@ export interface BetaWebSearchTool20250305 {
2369
2786
  */
2370
2787
  cache_control?: BetaCacheControlEphemeral | null;
2371
2788
 
2789
+ /**
2790
+ * If true, tool will not be included in initial system prompt. Only loaded when
2791
+ * returned via tool_reference from tool search.
2792
+ */
2793
+ defer_loading?: boolean;
2794
+
2372
2795
  /**
2373
2796
  * Maximum number of times the tool can be used in the API request.
2374
2797
  */
@@ -2581,6 +3004,12 @@ export interface MessageCreateParamsBase {
2581
3004
  */
2582
3005
  metadata?: BetaMetadata;
2583
3006
 
3007
+ /**
3008
+ * Body param: Configuration options for the model's output. Controls aspects like
3009
+ * how much effort the model puts into its response.
3010
+ */
3011
+ output_config?: BetaOutputConfig;
3012
+
2584
3013
  /**
2585
3014
  * Body param: A schema to specify Claude's output format in responses.
2586
3015
  */
@@ -2880,6 +3309,12 @@ export interface MessageCountTokensParams {
2880
3309
  */
2881
3310
  mcp_servers?: Array<BetaRequestMCPServerURLDefinition>;
2882
3311
 
3312
+ /**
3313
+ * Body param: Configuration options for the model's output. Controls aspects like
3314
+ * how much effort the model puts into its response.
3315
+ */
3316
+ output_config?: BetaOutputConfig;
3317
+
2883
3318
  /**
2884
3319
  * Body param: A schema to specify Claude's output format in responses.
2885
3320
  */
@@ -3000,11 +3435,15 @@ export interface MessageCountTokensParams {
3000
3435
  | BetaMemoryTool20250818
3001
3436
  | BetaToolComputerUse20250124
3002
3437
  | BetaToolTextEditor20241022
3438
+ | BetaToolComputerUse20251124
3003
3439
  | BetaToolTextEditor20250124
3004
3440
  | BetaToolTextEditor20250429
3005
3441
  | BetaToolTextEditor20250728
3006
3442
  | BetaWebSearchTool20250305
3007
3443
  | BetaWebFetchTool20250910
3444
+ | BetaToolSearchToolBm25_20251119
3445
+ | BetaToolSearchToolRegex20251119
3446
+ | BetaMCPToolset
3008
3447
  >;
3009
3448
 
3010
3449
  /**
@@ -3075,6 +3514,7 @@ export declare namespace Messages {
3075
3514
  type BetaContextManagementConfig as BetaContextManagementConfig,
3076
3515
  type BetaContextManagementResponse as BetaContextManagementResponse,
3077
3516
  type BetaCountTokensContextManagementResponse as BetaCountTokensContextManagementResponse,
3517
+ type BetaDirectCaller as BetaDirectCaller,
3078
3518
  type BetaDocumentBlock as BetaDocumentBlock,
3079
3519
  type BetaFileDocumentSource as BetaFileDocumentSource,
3080
3520
  type BetaFileImageSource as BetaFileImageSource,
@@ -3083,9 +3523,12 @@ export declare namespace Messages {
3083
3523
  type BetaInputTokensClearAtLeast as BetaInputTokensClearAtLeast,
3084
3524
  type BetaInputTokensTrigger as BetaInputTokensTrigger,
3085
3525
  type BetaJSONOutputFormat as BetaJSONOutputFormat,
3526
+ type BetaMCPToolConfig as BetaMCPToolConfig,
3527
+ type BetaMCPToolDefaultConfig as BetaMCPToolDefaultConfig,
3086
3528
  type BetaMCPToolResultBlock as BetaMCPToolResultBlock,
3087
3529
  type BetaMCPToolUseBlock as BetaMCPToolUseBlock,
3088
3530
  type BetaMCPToolUseBlockParam as BetaMCPToolUseBlockParam,
3531
+ type BetaMCPToolset as BetaMCPToolset,
3089
3532
  type BetaMemoryTool20250818 as BetaMemoryTool20250818,
3090
3533
  type BetaMemoryTool20250818Command as BetaMemoryTool20250818Command,
3091
3534
  type BetaMemoryTool20250818CreateCommand as BetaMemoryTool20250818CreateCommand,
@@ -3099,6 +3542,7 @@ export declare namespace Messages {
3099
3542
  type BetaMessageParam as BetaMessageParam,
3100
3543
  type BetaMessageTokensCount as BetaMessageTokensCount,
3101
3544
  type BetaMetadata as BetaMetadata,
3545
+ type BetaOutputConfig as BetaOutputConfig,
3102
3546
  type BetaPlainTextSource as BetaPlainTextSource,
3103
3547
  type BetaRawContentBlockDelta as BetaRawContentBlockDelta,
3104
3548
  type BetaRawContentBlockDeltaEvent as BetaRawContentBlockDeltaEvent,
@@ -3115,6 +3559,7 @@ export declare namespace Messages {
3115
3559
  type BetaRequestMCPServerURLDefinition as BetaRequestMCPServerURLDefinition,
3116
3560
  type BetaRequestMCPToolResultBlockParam as BetaRequestMCPToolResultBlockParam,
3117
3561
  type BetaSearchResultBlockParam as BetaSearchResultBlockParam,
3562
+ type BetaServerToolCaller as BetaServerToolCaller,
3118
3563
  type BetaServerToolUsage as BetaServerToolUsage,
3119
3564
  type BetaServerToolUseBlock as BetaServerToolUseBlock,
3120
3565
  type BetaServerToolUseBlockParam as BetaServerToolUseBlockParam,
@@ -3154,8 +3599,19 @@ export declare namespace Messages {
3154
3599
  type BetaToolChoiceTool as BetaToolChoiceTool,
3155
3600
  type BetaToolComputerUse20241022 as BetaToolComputerUse20241022,
3156
3601
  type BetaToolComputerUse20250124 as BetaToolComputerUse20250124,
3602
+ type BetaToolComputerUse20251124 as BetaToolComputerUse20251124,
3603
+ type BetaToolReferenceBlock as BetaToolReferenceBlock,
3604
+ type BetaToolReferenceBlockParam as BetaToolReferenceBlockParam,
3157
3605
  type BetaToolResultBlockParam as BetaToolResultBlockParam,
3158
3606
  type BetaToolResultContentBlockParam as BetaToolResultContentBlockParam,
3607
+ type BetaToolSearchToolBm25_20251119 as BetaToolSearchToolBm25_20251119,
3608
+ type BetaToolSearchToolRegex20251119 as BetaToolSearchToolRegex20251119,
3609
+ type BetaToolSearchToolResultBlock as BetaToolSearchToolResultBlock,
3610
+ type BetaToolSearchToolResultBlockParam as BetaToolSearchToolResultBlockParam,
3611
+ type BetaToolSearchToolResultError as BetaToolSearchToolResultError,
3612
+ type BetaToolSearchToolResultErrorParam as BetaToolSearchToolResultErrorParam,
3613
+ type BetaToolSearchToolSearchResultBlock as BetaToolSearchToolSearchResultBlock,
3614
+ type BetaToolSearchToolSearchResultBlockParam as BetaToolSearchToolSearchResultBlockParam,
3159
3615
  type BetaToolTextEditor20241022 as BetaToolTextEditor20241022,
3160
3616
  type BetaToolTextEditor20250124 as BetaToolTextEditor20250124,
3161
3617
  type BetaToolTextEditor20250429 as BetaToolTextEditor20250429,