The whole hunk
from line 1, old and new numbered
/
lines
The two sides of this change are more than 400 edits apart, too far apart to line up, so this is the differ's own diff of it and the words inside a line are not marked.
from line 1
1---
2title: Count tokens in a Message
3url: https://platform.claude.com/docs/en/api/beta/messages/count_tokens
4---
5
16# Count tokens in a Message
27
38**POST** `/v1/messages/count_tokens`
from line 21
1621
1722 - `string`
1823
19 - `"message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 41 more`
24 - `"message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 42 more`
2025
2126 - `"message-batches-2024-09-24"`
2227
from line 69
6469
6570 - `"user-profiles-2026-08-18"`
6671
72 - `"user-profiles-2026-09-04"`
73
6774 - `"advisor-tool-2026-03-01"`
6875
6976 - `"managed-agents-2026-04-01"`
from line 116
109116- `"anthropic-user-profile-id": optional string`
110117
111118 The user profile ID to attribute this request to. Use when acting on behalf of a party other than your organization. Requires the `user-profiles` beta header.
119
120- `"anthropic-workspace-id": optional string`
112121
113122## Body parameters
114123
from line 180
171180
172181 - `BetaTextBlockParam object`
173182
183 - `type: "text"`
184
174185 - `text: string`
175186
176187 minLength: 1
177
178 - `type: "text"`
179188
180189 - `cache_control: optional BetaCacheControlEphemeral or null`
181190
from line 211
202211
203212 - `BetaCitationCharLocationParam object`
204213
214 - `type: "char_location"`
215
205216 - `cited_text: string`
206217
207218 - `document_index: number`
from line 229
218229
219230 minimum: 0
220231
221 - `type: "char_location"`
222
223232 - `BetaCitationPageLocationParam object`
224233
234 - `type: "page_location"`
235
225236 - `cited_text: string`
226237
227238 - `document_index: number`
from line 249
238249
239250 minimum: 1
240251
241 - `type: "page_location"`
242
243252 - `BetaCitationContentBlockLocationParam object`
244253
254 - `type: "content_block_location"`
255
245256 - `cited_text: string`
246257
247258 The full text of the cited block range, concatenated.
from line 279
268279
269280 minimum: 0
270281
271 - `type: "content_block_location"`
272
273282 - `BetaCitationWebSearchResultLocationParam object`
274283
284 - `type: "web_search_result_location"`
285
275286 - `cited_text: string`
276287
277288 - `encrypted_index: string`
from line 291
280291
281292 maxLength: 512, minLength: 1
282293
283 - `type: "web_search_result_location"`
284
285294 - `url: string`
286295
287296 minLength: 1
288297
289298 - `BetaCitationSearchResultLocationParam object`
290299
300 - `type: "search_result_location"`
301
291302 - `cited_text: string`
292303
293304 The full text of the cited block range, concatenated.
from line 329
318329
319330 - `title: string or null`
320331
321 - `type: "search_result_location"`
322
323332 - `BetaImageBlockParam object`
324333
334 - `type: "image"`
335
325336 - `source: BetaBase64ImageSource or BetaURLImageSource or BetaFileImageSource`
326337
327338 - `BetaBase64ImageSource object`
328339
340 - `type: "base64"`
341
329342 - `data: string`
330343
331344 format: byte
from line 353
340353
341354 - `"image/webp"`
342355
356 - `BetaURLImageSource object`
357
358 - `type: "url"`
359
360 - `url: string`
361
362 - `BetaFileImageSource object`
363
364 - `type: "file"`
365
366 - `file_id: string`
367
368 - `cache_control: optional BetaCacheControlEphemeral or null`
369
370 Create a cache control breakpoint at this content block.
371
372 - `transformations: optional BetaImageTransformationsParam or null`
373
374 Configures the transformations the server applies to this image before the model observes it. Each key names a condition the server transforms images for; its value selects the transformation applied. Omitted keys keep their default behavior, and an empty object is equivalent to omitting the field.
375
376 - `oversized_image: optional "downsize" or "error"`
377
378 What the server does when this image exceeds the model's maximum image size. `"downsize"` (the default) scales the image down to fit, which changes the dimensions the model observes without telling you. `"error"` instead rejects the request with a 400 error naming the image's dimensions and the largest dimensions that fit, so you can scale the image deliberately — your image is never silently scaled down.
379
380 - `"downsize"`
381
382 - `"error"`
383
384 - `BetaRequestDocumentBlock object`
385
386 - `type: "document"`
387
388 - `source: BetaBase64PDFSource or BetaPlainTextSource or BetaContentBlockSource or 2 more`
389
390 - `BetaBase64PDFSource object`
391
343392 - `type: "base64"`
344393
345 - `BetaURLImageSource object`
394 - `data: string`
395
396 format: byte
397
398 - `media_type: "application/pdf"`
399
400 - `BetaPlainTextSource object`
401
402 - `type: "text"`
403
404 - `data: string`
405
406 - `media_type: "text/plain"`
407
408 - `BetaContentBlockSource object`
409
410 - `type: "content"`
411
412 - `content: string or array of BetaContentBlockSourceContent`
413
414 - `string`
415
416 - `BetaContentBlockSourceContent = array of BetaContentBlockSourceContent`
417
418 - `BetaTextBlockParam object`
419
420 - `BetaImageBlockParam object`
421
422 - `BetaURLPDFSource object`
346423
347424 - `type: "url"`
348425
349426 - `url: string`
350427
351 - `BetaFileImageSource object`
428 - `BetaFileDocumentSource object`
429
430 - `type: "file"`
352431
353432 - `file_id: string`
354433
355 - `type: "file"`
356
357 - `type: "image"`
358
359434 - `cache_control: optional BetaCacheControlEphemeral or null`
360435
361436 Create a cache control breakpoint at this content block.
362437
363 - `transformations: optional BetaImageTransformationsParam or null`
364
365 Configures the transformations the server applies to this image before the model observes it. Each key names a condition the server transforms images for; its value selects the transformation applied. Omitted keys keep their default behavior, and an empty object is equivalent to omitting the field.
366
367 - `oversized_image: optional "downsize" or "error"`
368
369 What the server does when this image exceeds the model's maximum image size. `"downsize"` (the default) scales the image down to fit, which changes the dimensions the model observes without telling you. `"error"` instead rejects the request with a 400 error naming the image's dimensions and the largest dimensions that fit, so you can scale the image deliberately — your image is never silently scaled down.
370
371 - `"downsize"`
372
373 - `"error"`
374
375 - `BetaRequestDocumentBlock object`
376
377 - `source: BetaBase64PDFSource or BetaPlainTextSource or BetaContentBlockSource or 2 more`
378
379 - `BetaBase64PDFSource object`
380
381 - `data: string`
382
383 format: byte
384
385 - `media_type: "application/pdf"`
386
387 - `type: "base64"`
388
389 - `BetaPlainTextSource object`
390
391 - `data: string`
392
393 - `media_type: "text/plain"`
394
395 - `type: "text"`
396
397 - `BetaContentBlockSource object`
398
399 - `content: string or array of BetaContentBlockSourceContent`
400
401 - `string`
402
403 - `BetaContentBlockSourceContent = array of BetaContentBlockSourceContent`
404
405 - `BetaTextBlockParam object`
406
407 - `BetaImageBlockParam object`
408
409 - `type: "content"`
410
411 - `BetaURLPDFSource object`
412
413 - `type: "url"`
414
415 - `url: string`
416
417 - `BetaFileDocumentSource object`
418
419 - `file_id: string`
420
421 - `type: "file"`
422
423 - `type: "document"`
438 - `citations: optional BetaCitationsConfigParam or null`
439
440 - `enabled: optional boolean`
441
442 - `context: optional string or null`
443
444 minLength: 1
445
446 - `title: optional string or null`
447
448 maxLength: 500, minLength: 1
449
450 - `BetaSearchResultBlockParam object`
451
452 - `type: "search_result"`
453
454 - `content: array of BetaTextBlockParam`
455
456 - `type: "text"`
457
458 - `text: string`
459
460 minLength: 1
461
462 - `cache_control: optional BetaCacheControlEphemeral or null`
463
464 Create a cache control breakpoint at this content block.
465
466 - `citations: optional array of BetaTextCitationParam or null`
467
468 - `source: string`
469
470 - `title: string`
424471
425472 - `cache_control: optional BetaCacheControlEphemeral or null`
426473
427474 Create a cache control breakpoint at this content block.
428475
429 - `citations: optional BetaCitationsConfigParam or null`
430
431 - `enabled: optional boolean`
432
433 - `context: optional string or null`
434
435 minLength: 1
436
437 - `title: optional string or null`
438
439 maxLength: 500, minLength: 1
440
441 - `BetaSearchResultBlockParam object`
442
443 - `content: array of BetaTextBlockParam`
444
445 - `text: string`
446
447 minLength: 1
448
449 - `type: "text"`
450
451 - `cache_control: optional BetaCacheControlEphemeral or null`
452
453 Create a cache control breakpoint at this content block.
454
455 - `citations: optional array of BetaTextCitationParam or null`
456
457 - `source: string`
458
459 - `title: string`
460
461 - `type: "search_result"`
476 - `citations: optional BetaCitationsConfigParam`
477
478 - `BetaThinkingBlockParam object`
479
480 - `type: "thinking"`
481
482 - `signature: string`
483
484 The `signature` value of this thinking block, exactly as returned by the API in a previous response. Used to verify that the block was generated by Claude.
485
486 Thinking blocks must be passed back unmodified and in their original order; a modified block results in a 400 `invalid_request_error`.
487
488 - `thinking: string`
489
490 The `thinking` text of this block as returned by the API.
491
492 - `BetaRedactedThinkingBlockParam object`
493
494 - `type: "redacted_thinking"`
495
496 - `data: string`
497
498 The `data` value of this redacted thinking block, exactly as returned by the API in a previous response. Opaque and encrypted; pass it back unchanged.
499
500 - `BetaToolUseBlockParam object`
501
502 - `type: "tool_use"`
503
504 - `id: string`
505
506 pattern: ^[a-zA-Z0-9_-]+$
507
508 - `input: map[unknown]`
509
510 - `name: string`
511
512 maxLength: 200, minLength: 1
462513
463514 - `cache_control: optional BetaCacheControlEphemeral or null`
464515
465516 Create a cache control breakpoint at this content block.
466517
467 - `citations: optional BetaCitationsConfigParam`
468
469 - `BetaThinkingBlockParam object`
470
471 - `signature: string`
472
473 The `signature` value of this thinking block, exactly as returned by the API in a previous response. Used to verify that the block was generated by Claude.
474
475 Thinking blocks must be passed back unmodified and in their original order; a modified block results in a 400 `invalid_request_error`.
476
477 - `thinking: string`
478
479 The `thinking` text of this block as returned by the API.
480
481 - `type: "thinking"`
482
483 - `BetaRedactedThinkingBlockParam object`
484
485 - `data: string`
486
487 The `data` value of this redacted thinking block, exactly as returned by the API in a previous response. Opaque and encrypted; pass it back unchanged.
488
489 - `type: "redacted_thinking"`
490
491 - `BetaToolUseBlockParam object`
492
493 - `id: string`
518 - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120`
519
520 Tool invocation directly from the model.
521
522 - `BetaDirectCaller object`
523
524 Tool invocation directly from the model.
525
526 - `type: "direct"`
527
528 - `BetaServerToolCaller object`
529
530 Tool invocation generated by a server-side tool.
531
532 - `type: "code_execution_20250825"`
533
534 - `tool_id: string`
535
536 pattern: ^srvtoolu_[a-zA-Z0-9_]+$
537
538 - `BetaServerToolCaller20260120 object`
539
540 - `type: "code_execution_20260120"`
541
542 - `tool_id: string`
543
544 pattern: ^srvtoolu_[a-zA-Z0-9_]+$
545
546 - `toolset_name: optional string or null`
547
548 For a toolset member tool_use, the toolset family this member belongs to.
549
550 maxLength: 64, minLength: 1, pattern: ^[a-zA-Z0-9_-]+$
551
552 - `BetaToolResultBlockParam object`
553
554 - `type: "tool_result"`
555
556 - `tool_use_id: string`
494557
495558 pattern: ^[a-zA-Z0-9_-]+$
496559
497 - `input: map[unknown]`
498
499 - `name: string`
500
501 maxLength: 200, minLength: 1
502
503 - `type: "tool_use"`
504
505560 - `cache_control: optional BetaCacheControlEphemeral or null`
506561
507562 Create a cache control breakpoint at this content block.
508563
509 - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120`
510
511 Tool invocation directly from the model.
512
513 - `BetaDirectCaller object`
514
515 Tool invocation directly from the model.
516
517 - `type: "direct"`
518
519 - `BetaServerToolCaller object`
520
521 Tool invocation generated by a server-side tool.
522
523 - `tool_id: string`
524
525 pattern: ^srvtoolu_[a-zA-Z0-9_]+$
526
527 - `type: "code_execution_20250825"`
528
529 - `BetaServerToolCaller20260120 object`
530
531 - `tool_id: string`
532
533 pattern: ^srvtoolu_[a-zA-Z0-9_]+$
534
535 - `type: "code_execution_20260120"`
536
537 - `toolset_name: optional string or null`
538
539 For a toolset member tool_use, the toolset family this member belongs to.
540
541 maxLength: 64, minLength: 1, pattern: ^[a-zA-Z0-9_-]+$
542
543 - `BetaToolResultBlockParam object`
544
545 - `tool_use_id: string`
546
547 pattern: ^[a-zA-Z0-9_-]+$
548
549 - `type: "tool_result"`
550
551 - `cache_control: optional BetaCacheControlEphemeral or null`
552
553 Create a cache control breakpoint at this content block.
554
555564 - `content: optional string or array of BetaTextBlockParam or BetaImageBlockParam or BetaSearchResultBlockParam or 3 more`
556565
557566 - `string`
from line 579
570579
571580 Tool reference block that can be included in tool_result content.
572581
582 - `type: "tool_reference"`
583
573584 - `tool_name: string`
574585
575586 maxLength: 256, minLength: 1, pattern: ^[a-zA-Z0-9_-]{1,256}$
576
577 - `type: "tool_reference"`
578587
579588 - `cache_control: optional BetaCacheControlEphemeral or null`
580589
from line 599
590599 browser toolset member `tool_use`. The server renders the
591600 model-visible text from it; the model never sees the raw fields.
592601
602 - `type: "browser_state"`
603
593604 - `tabs: array of BetaBrowserStateTabEntry`
594605
595606 All tabs open in the browser after this call — the full inventory, not a delta. May be empty. Whenever non-empty, exactly one entry carries `active: true`.
from line 628
617628 - `active: optional boolean`
618629
619630 Whether this tab is the active tab after this call. Whenever `tabs` is non-empty, exactly one entry is marked `active: true`.
620
621 - `type: "browser_state"`
622631
623632 - `cache_control: optional BetaCacheControlEphemeral or null`
624633
from line 649
640649 during a failed call gets no deferred `tab_opened`; it simply appears
641650 in the next result's `tabs` inventory.
642651
652 - `type: "tab_opened"`
653
643654 - `tab_id: string`
644655
645656 The `tab_id` of the opened tab, present in `tabs`.
646657
647658 maxLength: 4096, minLength: 1, pattern: ^[^\x00-\x1f\x7f-\x9f\u2028\u2029]*$
648659
649 - `type: "tab_opened"`
650
651660 - `BetaBrowserStateChangeDownloadStarted object`
652661
653662 A file download that started during this call.
654663
664 - `type: "download_started"`
665
655666 - `download_id: string`
656667
657668 The caller-assigned identifier for this download, stable across the state changes reporting it.
658669
659670 maxLength: 4096, minLength: 1, pattern: ^[^\x00-\x1f\x7f-\x9f\u2028\u2029]*$
660
661 - `type: "download_started"`
662671
663672 - `url: string`
664673
from line 682
673682 `download_started`, when the download finished during the call that
674683 started it (at most one state change per `download_id` per result).
675684
685 - `type: "download_completed"`
686
676687 - `download_id: string`
677688
678689 The caller-assigned identifier for this download, stable across the state changes reporting it.
679690
680691 maxLength: 4096, minLength: 1, pattern: ^[^\x00-\x1f\x7f-\x9f\u2028\u2029]*$
681692
682 - `type: "download_completed"`
683
684693 - `url: string`
685694
686695 The final post-redirect URL the download was served from.
from line 712
703712
704713 A file download that failed — or was cancelled — during this call.
705714
715 - `type: "download_failed"`
716
706717 - `download_id: string`
707718
708719 The caller-assigned identifier for this download, stable across the state changes reporting it.
709720
710721 maxLength: 4096, minLength: 1, pattern: ^[^\x00-\x1f\x7f-\x9f\u2028\u2029]*$
711722
712 - `type: "download_failed"`
713
714723 - `url: string`
715724
716725 The final post-redirect URL the download was served from.
from line 742
733742
734743 - `BetaServerToolUseBlockParam object`
735744
745 - `type: "server_tool_use"`
746
736747 - `id: string`
737748
738749 pattern: ^srvtoolu_[a-zA-Z0-9_]+$
from line 768
757768
758769 - `"tool_search_tool_bm25"`
759770
760 - `type: "server_tool_use"`
761
762771 - `cache_control: optional BetaCacheControlEphemeral or null`
763772
764773 Create a cache control breakpoint at this content block.
from line 788
779788
780789 - `BetaWebSearchToolResultBlockParam object`
781790
791 - `type: "web_search_tool_result"`
792
782793 - `content: BetaWebSearchToolResultBlockParamContent`
783794
784795 - `ResultBlock = array of BetaWebSearchResultBlockParam`
785796
797 - `type: "web_search_result"`
798
786799 - `encrypted_content: string`
787800
788801 - `title: string`
789802
790 - `type: "web_search_result"`
791
792803 - `url: string`
793804
794805 - `page_age: optional string or null`
795806
796807 - `BetaWebSearchToolRequestError object`
797808
809 - `type: "web_search_tool_result_error"`
810
798811 - `error_code: BetaWebSearchToolResultErrorCode`
799812
800813 - `"invalid_tool_input"`
from line 822
809822
810823 - `"request_too_large"`
811824
812 - `type: "web_search_tool_result_error"`
813
814825 - `tool_use_id: string`
815826
816827 pattern: ^srvtoolu_[a-zA-Z0-9_]+$
817828
818 - `type: "web_search_tool_result"`
819
820829 - `cache_control: optional BetaCacheControlEphemeral or null`
821830
822831 Create a cache control breakpoint at this content block.
from line 846
837846
838847 - `BetaWebFetchToolResultBlockParam object`
839848
849 - `type: "web_fetch_tool_result"`
850
840851 - `content: BetaWebFetchToolResultErrorBlockParam or BetaWebFetchBlockParam`
841852
842853 - `BetaWebFetchToolResultErrorBlockParam object`
843854
855 - `type: "web_fetch_tool_result_error"`
856
844857 - `error_code: BetaWebFetchToolResultErrorCode`
845858
846859 - `"invalid_tool_input"`
from line 874
861874
862875 - `"unavailable"`
863876
864 - `type: "web_fetch_tool_result_error"`
877 - `"content_too_large"`
865878
866879 - `BetaWebFetchBlockParam object`
867880
881 - `type: "web_fetch_result"`
882
868883 - `content: BetaRequestDocumentBlock`
869884
870 - `type: "web_fetch_result"`
871
872885 - `url: string`
873886
874887 Fetched content URL
from line 894
881894
882895 pattern: ^srvtoolu_[a-zA-Z0-9_]+$
883896
884 - `type: "web_fetch_tool_result"`
885
886897 - `cache_control: optional BetaCacheControlEphemeral or null`
887898
888899 Create a cache control breakpoint at this content block.
from line 914
903914
904915 - `BetaAdvisorToolResultBlockParam object`
905916
917 - `type: "advisor_tool_result"`
918
906919 - `content: BetaAdvisorToolResultErrorParam or BetaAdvisorResultBlockParam or BetaAdvisorRedactedResultBlockParam`
907920
908921 - `BetaAdvisorToolResultErrorParam object`
909922
923 - `type: "advisor_tool_result_error"`
924
910925 - `error_code: "max_uses_exceeded" or "prompt_too_long" or "too_many_requests" or 4 more`
911926
912927 - `"max_uses_exceeded"`
from line 938
923938
924939 - `"model_not_found"`
925940
926 - `type: "advisor_tool_result_error"`
927
928941 - `BetaAdvisorResultBlockParam object`
929942
943 - `type: "advisor_result"`
944
930945 - `text: string`
931946
932 - `type: "advisor_result"`
933
934947 - `stop_reason: optional string or null`
935948
936949 - `BetaAdvisorRedactedResultBlockParam object`
937950
951 - `type: "advisor_redacted_result"`
952
938953 - `encrypted_content: string`
939954
940955 Opaque blob produced by a prior response; must be round-tripped verbatim.
941956
942 - `type: "advisor_redacted_result"`
943
944957 - `stop_reason: optional string or null`
945958
946959 - `tool_use_id: string`
947960
948961 pattern: ^srvtoolu_[a-zA-Z0-9_]+$
949962
950 - `type: "advisor_tool_result"`
951
952963 - `cache_control: optional BetaCacheControlEphemeral or null`
953964
954965 Create a cache control breakpoint at this content block.
955966
956967 - `BetaCodeExecutionToolResultBlockParam object`
957968
969 - `type: "code_execution_tool_result"`
970
958971 - `content: BetaCodeExecutionToolResultBlockParamContent`
959972
960973 Code execution result with encrypted stdout for PFC + web_search results.
961974
962975 - `BetaCodeExecutionToolResultErrorParam object`
963976
977 - `type: "code_execution_tool_result_error"`
978
964979 - `error_code: BetaCodeExecutionToolResultErrorCode`
965980
966981 - `"invalid_tool_input"`
from line 986
971986
972987 - `"execution_time_exceeded"`
973988
974 - `type: "code_execution_tool_result_error"`
975
976989 - `BetaCodeExecutionResultBlockParam object`
977990
991 - `type: "code_execution_result"`
992
978993 - `content: array of BetaCodeExecutionOutputBlockParam`
979994
995 - `type: "code_execution_output"`
996
980997 - `file_id: string`
981998
999 - `return_code: number`
1000
1001 - `stderr: string`
1002
1003 - `stdout: string`
1004
1005 - `BetaEncryptedCodeExecutionResultBlockParam object`
1006
1007 Code execution result with encrypted stdout for PFC + web_search results.
1008
1009 - `type: "encrypted_code_execution_result"`
1010
1011 - `content: array of BetaCodeExecutionOutputBlockParam`
1012
9821013 - `type: "code_execution_output"`
9831014
1015 - `file_id: string`
1016
1017 - `encrypted_stdout: string`
1018
9841019 - `return_code: number`
9851020
9861021 - `stderr: string`
9871022
1023 - `tool_use_id: string`
1024
1025 pattern: ^srvtoolu_[a-zA-Z0-9_]+$
1026
1027 - `cache_control: optional BetaCacheControlEphemeral or null`
1028
1029 Create a cache control breakpoint at this content block.
1030
1031 - `BetaBashCodeExecutionToolResultBlockParam object`
1032
1033 - `type: "bash_code_execution_tool_result"`
1034
1035 - `content: BetaBashCodeExecutionToolResultErrorParam or BetaBashCodeExecutionResultBlockParam`
1036
1037 - `BetaBashCodeExecutionToolResultErrorParam object`
1038
1039 - `type: "bash_code_execution_tool_result_error"`
1040
1041 - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more`
1042
1043 - `"invalid_tool_input"`
1044
1045 - `"unavailable"`
1046
1047 - `"too_many_requests"`
1048
1049 - `"execution_time_exceeded"`
1050
1051 - `"output_file_too_large"`
1052
1053 - `BetaBashCodeExecutionResultBlockParam object`
1054
1055 - `type: "bash_code_execution_result"`
1056
1057 - `content: array of BetaBashCodeExecutionOutputBlockParam`
1058
1059 - `type: "bash_code_execution_output"`
1060
1061 - `file_id: string`
1062
1063 - `return_code: number`
1064
1065 - `stderr: string`
1066
9881067 - `stdout: string`
9891068
990 - `type: "code_execution_result"`
991
992 - `BetaEncryptedCodeExecutionResultBlockParam object`
993
994 Code execution result with encrypted stdout for PFC + web_search results.
995
996 - `content: array of BetaCodeExecutionOutputBlockParam`
997
998 - `file_id: string`
999
1000 - `type: "code_execution_output"`
1001
1002 - `encrypted_stdout: string`
1003
1004 - `return_code: number`
1005
1006 - `stderr: string`
1007
1008 - `type: "encrypted_code_execution_result"`
1009
10101069 - `tool_use_id: string`
10111070
10121071 pattern: ^srvtoolu_[a-zA-Z0-9_]+$
10131072
1014 - `type: "code_execution_tool_result"`
1015
10161073 - `cache_control: optional BetaCacheControlEphemeral or null`
10171074
10181075 Create a cache control breakpoint at this content block.
10191076
1020 - `BetaBashCodeExecutionToolResultBlockParam object`
1021
1022 - `content: BetaBashCodeExecutionToolResultErrorParam or BetaBashCodeExecutionResultBlockParam`
1023
1024 - `BetaBashCodeExecutionToolResultErrorParam object`
1077 - `BetaTextEditorCodeExecutionToolResultBlockParam object`
1078
1079 - `type: "text_editor_code_execution_tool_result"`
1080
1081 - `content: BetaTextEditorCodeExecutionToolResultErrorParam or BetaTextEditorCodeExecutionViewResultBlockParam or BetaTextEditorCodeExecutionCreateResultBlockParam or BetaTextEditorCodeExecutionStrReplaceResultBlockParam`
1082
1083 - `BetaTextEditorCodeExecutionToolResultErrorParam object`
1084
1085 - `type: "text_editor_code_execution_tool_result_error"`
10251086
10261087 - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more`
10271088
from line 1094
10331094
10341095 - `"execution_time_exceeded"`
10351096
1036 - `"output_file_too_large"`
1037
1038 - `type: "bash_code_execution_tool_result_error"`
1039
1040 - `BetaBashCodeExecutionResultBlockParam object`
1041
1042 - `content: array of BetaBashCodeExecutionOutputBlockParam`
1043
1044 - `file_id: string`
1045
1046 - `type: "bash_code_execution_output"`
1047
1048 - `return_code: number`
1049
1050 - `stderr: string`
1051
1052 - `stdout: string`
1053
1054 - `type: "bash_code_execution_result"`
1097 - `"file_not_found"`
1098
1099 - `error_message: optional string or null`
1100
1101 - `BetaTextEditorCodeExecutionViewResultBlockParam object`
1102
1103 - `type: "text_editor_code_execution_view_result"`
1104
1105 - `content: string`
1106
1107 - `file_type: "text" or "image" or "pdf"`
1108
1109 - `"text"`
1110
1111 - `"image"`
1112
1113 - `"pdf"`
1114
1115 - `num_lines: optional number or null`
1116
1117 - `start_line: optional number or null`
1118
1119 - `total_lines: optional number or null`
1120
1121 - `BetaTextEditorCodeExecutionCreateResultBlockParam object`
1122
1123 - `type: "text_editor_code_execution_create_result"`
1124
1125 - `is_file_update: boolean`
1126
1127 - `BetaTextEditorCodeExecutionStrReplaceResultBlockParam object`
1128
1129 - `type: "text_editor_code_execution_str_replace_result"`
1130
1131 - `lines: optional array of string or null`
1132
1133 - `new_lines: optional number or null`
1134
1135 - `new_start: optional number or null`
1136
1137 - `old_lines: optional number or null`
1138
1139 - `old_start: optional number or null`
10551140
10561141 - `tool_use_id: string`
10571142
10581143 pattern: ^srvtoolu_[a-zA-Z0-9_]+$
10591144
1060 - `type: "bash_code_execution_tool_result"`
1061
10621145 - `cache_control: optional BetaCacheControlEphemeral or null`
10631146
10641147 Create a cache control breakpoint at this content block.
10651148
1066 - `BetaTextEditorCodeExecutionToolResultBlockParam object`
1067
1068 - `content: BetaTextEditorCodeExecutionToolResultErrorParam or BetaTextEditorCodeExecutionViewResultBlockParam or BetaTextEditorCodeExecutionCreateResultBlockParam or BetaTextEditorCodeExecutionStrReplaceResultBlockParam`
1069
1070 - `BetaTextEditorCodeExecutionToolResultErrorParam object`
1071
1072 - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more`
1149 - `BetaToolSearchToolResultBlockParam object`
1150
1151 - `type: "tool_search_tool_result"`
1152
1153 - `content: BetaToolSearchToolResultErrorParam or BetaToolSearchToolSearchResultBlockParam`
1154
1155 - `BetaToolSearchToolResultErrorParam object`
1156
1157 - `type: "tool_search_tool_result_error"`
1158
1159 - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"`
10731160
10741161 - `"invalid_tool_input"`
10751162
from line 1166
10791166
10801167 - `"execution_time_exceeded"`
10811168
1082 - `"file_not_found"`
1083
1084 - `type: "text_editor_code_execution_tool_result_error"`
1085
10861169 - `error_message: optional string or null`
10871170
1088 - `BetaTextEditorCodeExecutionViewResultBlockParam object`
1089
1090 - `content: string`
1091
1092 - `file_type: "text" or "image" or "pdf"`
1093
1094 - `"text"`
1095
1096 - `"image"`
1097
1098 - `"pdf"`
1099
1100 - `type: "text_editor_code_execution_view_result"`
1101
1102 - `num_lines: optional number or null`
1103
1104 - `start_line: optional number or null`
1105
1106 - `total_lines: optional number or null`
1107
1108 - `BetaTextEditorCodeExecutionCreateResultBlockParam object`
1109
1110 - `is_file_update: boolean`
1111
1112 - `type: "text_editor_code_execution_create_result"`
1113
1114 - `BetaTextEditorCodeExecutionStrReplaceResultBlockParam object`
1115
1116 - `type: "text_editor_code_execution_str_replace_result"`
1117
1118 - `lines: optional array of string or null`
1119
1120 - `new_lines: optional number or null`
1121
1122 - `new_start: optional number or null`
1123
1124 - `old_lines: optional number or null`
1125
1126 - `old_start: optional number or null`
1171 - `BetaToolSearchToolSearchResultBlockParam object`
1172
1173 - `type: "tool_search_tool_search_result"`
1174
1175 - `tool_references: array of BetaToolReferenceBlockParam`
1176
1177 - `type: "tool_reference"`
1178
1179 - `tool_name: string`
1180
1181 maxLength: 256, minLength: 1, pattern: ^[a-zA-Z0-9_-]{1,256}$
1182
1183 - `cache_control: optional BetaCacheControlEphemeral or null`
1184
1185 Create a cache control breakpoint at this content block.
11271186
11281187 - `tool_use_id: string`
11291188
11301189 pattern: ^srvtoolu_[a-zA-Z0-9_]+$
11311190
1132 - `type: "text_editor_code_execution_tool_result"`
1133
11341191 - `cache_control: optional BetaCacheControlEphemeral or null`
11351192
11361193 Create a cache control breakpoint at this content block.
11371194
1138 - `BetaToolSearchToolResultBlockParam object`
1139
1140 - `content: BetaToolSearchToolResultErrorParam or BetaToolSearchToolSearchResultBlockParam`
1141
1142 - `BetaToolSearchToolResultErrorParam object`
1143
1144 - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"`
1145
1146 - `"invalid_tool_input"`
1147
1148 - `"unavailable"`
1149
1150 - `"too_many_requests"`
1151
1152 - `"execution_time_exceeded"`
1153
1154 - `type: "tool_search_tool_result_error"`
1155
1156 - `error_message: optional string or null`
1157
1158 - `BetaToolSearchToolSearchResultBlockParam object`
1159
1160 - `tool_references: array of BetaToolReferenceBlockParam`
1161
1162 - `tool_name: string`
1163
1164 maxLength: 256, minLength: 1, pattern: ^[a-zA-Z0-9_-]{1,256}$
1165
1166 - `type: "tool_reference"`
1167
1168 - `cache_control: optional BetaCacheControlEphemeral or null`
1169
1170 Create a cache control breakpoint at this content block.
1171
1172 - `type: "tool_search_tool_search_result"`
1195 - `BetaMCPToolUseBlockParam object`
1196
1197 - `type: "mcp_tool_use"`
1198
1199 - `id: string`
1200
1201 pattern: ^[a-zA-Z0-9_-]+$
1202
1203 - `input: map[unknown]`
1204
1205 - `name: string`
1206
1207 - `server_name: string`
1208
1209 The name of the MCP server
1210
1211 - `cache_control: optional BetaCacheControlEphemeral or null`
1212
1213 Create a cache control breakpoint at this content block.
1214
1215 - `BetaRequestMCPToolResultBlockParam object`
1216
1217 - `type: "mcp_tool_result"`
11731218
11741219 - `tool_use_id: string`
11751220
1176 pattern: ^srvtoolu_[a-zA-Z0-9_]+$
1177
1178 - `type: "tool_search_tool_result"`
1221 pattern: ^[a-zA-Z0-9_-]+$
11791222
11801223 - `cache_control: optional BetaCacheControlEphemeral or null`
11811224
11821225 Create a cache control breakpoint at this content block.
11831226
1184 - `BetaMCPToolUseBlockParam object`
1185
1186 - `id: string`
1187
1188 pattern: ^[a-zA-Z0-9_-]+$
1189
1190 - `input: map[unknown]`
1191
1192 - `name: string`
1193
1194 - `server_name: string`
1195
1196 The name of the MCP server
1197
1198 - `type: "mcp_tool_use"`
1199
1200 - `cache_control: optional BetaCacheControlEphemeral or null`
1201
1202 Create a cache control breakpoint at this content block.
1203
1204 - `BetaRequestMCPToolResultBlockParam object`
1205
1206 - `tool_use_id: string`
1207
1208 pattern: ^[a-zA-Z0-9_-]+$
1209
1210 - `type: "mcp_tool_result"`
1211
1212 - `cache_control: optional BetaCacheControlEphemeral or null`
1213
1214 Create a cache control breakpoint at this content block.
1215
12161227 - `content: optional string or array of BetaTextBlockParam`
12171228
12181229 - `string`
12191230
12201231 - `BetaMCPToolResultBlockParamContent = array of BetaTextBlockParam`
12211232
1233 - `type: "text"`
1234
12221235 - `text: string`
12231236
12241237 minLength: 1
1225
1226 - `type: "text"`
12271238
12281239 - `cache_control: optional BetaCacheControlEphemeral or null`
12291240
from line 1249
12381249 A content block that represents a file to be uploaded to the container
12391250 Files uploaded via this block will be available in the container's input directory.
12401251
1252 - `type: "container_upload"`
1253
12411254 - `file_id: string`
1242
1243 - `type: "container_upload"`
12441255
12451256 - `cache_control: optional BetaCacheControlEphemeral or null`
12461257
from line 1288
12771288 `tool` references a tool (or MCP toolset) by name from the request's
12781289 `tools`; it is offered to the model from this point in the
12791290 conversation onward.
1291
1292 - `type: "tool_addition"`
12801293
12811294 - `tool: BetaToolChangeToolReference or BetaToolChangeMCPToolReference or BetaToolChangeMCPToolsetReference`
12821295
from line 1305
12921305 server assigns to MCP-resolved tools — use `mcp_tool_reference` or
12931306 `mcp_toolset_reference` for those.
12941307
1308 - `type: "tool_reference"`
1309
12951310 - `name: string`
12961311
12971312 pattern: ^[a-zA-Z0-9_-]{1,128}$
1298
1299 - `type: "tool_reference"`
13001313
13011314 - `BetaToolChangeMCPToolReference object`
13021315
13031316 Reference to a single MCP tool by its server and remote name — the
13041317 same `server_name`/`name` pair `mcp_tool_use` carries.
13051318
1319 - `type: "mcp_tool_reference"`
1320
13061321 - `name: string`
13071322
13081323 - `server_name: string`
13091324
1310 - `type: "mcp_tool_reference"`
1311
13121325 - `BetaToolChangeMCPToolsetReference object`
13131326
13141327 Reference to every tool in the named MCP server's toolset.
13151328
1329 - `type: "mcp_toolset_reference"`
1330
13161331 - `server_name: string`
1317
1318 - `type: "mcp_toolset_reference"`
1319
1320 - `type: "tool_addition"`
13211332
13221333 - `cache_control: optional BetaCacheControlEphemeral or null`
13231334
from line 1341
13301341 `tool` references a tool (or MCP toolset) by name from the request's
13311342 `tools`; it is no longer offered to the model from this point in the
13321343 conversation onward.
1344
1345 - `type: "tool_removal"`
13331346
13341347 - `tool: BetaToolChangeToolReference or BetaToolChangeMCPToolReference or BetaToolChangeMCPToolsetReference`
13351348
from line 1366
13531366 - `BetaToolChangeMCPToolsetReference object`
13541367
13551368 Reference to every tool in the named MCP server's toolset.
1356
1357 - `type: "tool_removal"`
13581369
13591370 - `cache_control: optional BetaCacheControlEphemeral or null`
13601371
from line 1387
13761387 likewise rejected; between non-thinking blocks the block's placement has
13771388 no validation effect.
13781389
1390 - `type: "fallback"`
1391
13791392 - `from: BetaFallbackInfoParam`
13801393
13811394 Identifies one hop of a fallback transition.
from line 1478
14651478 - `to: BetaFallbackInfoParam`
14661479
14671480 Identifies one hop of a fallback transition.
1468
1469 - `type: "fallback"`
14701481
14711482 - `trigger: optional unknown`
14721483
from line 1645
16341645
16351646 maxItems: 20
16361647
1648 - `type: "url"`
1649
16371650 - `name: string`
16381651
1639 - `type: "url"`
1640
16411652 - `url: string`
16421653
16431654 - `authorization_token: optional string or null`
from line 1681
16701681
16711682 A schema to specify Claude's output format in responses. See [structured outputs](https://platform.claude.com/docs/en/build-with-claude/structured-outputs)
16721683
1684 - `type: "json_schema"`
1685
16731686 - `schema: map[unknown]`
16741687
16751688 The JSON schema of the format
16761689
1677 - `type: "json_schema"`
1678
16791690 - `task_budget: optional BetaTokenTaskBudget or null`
16801691
16811692 User-configurable total token budget across contexts.
16821693
1694 - `type: "tokens"`
1695
1696 The budget type. Currently only 'tokens' is supported.
1697
16831698 - `total: number`
16841699
16851700 Total token budget across all contexts in the session.
16861701
16871702 minimum: 1024
16881703
1689 - `type: "tokens"`
1690
1691 The budget type. Currently only 'tokens' is supported.
1692
16931704 - `remaining: optional number or null`
16941705
16951706 Remaining tokens in the budget. Use this to track usage across contexts when implementing compaction client-side. Defaults to total if not provided.
from line 1725
17141725
17151726 - `array of BetaTextBlockParam`
17161727
1728 - `type: "text"`
1729
17171730 - `text: string`
17181731
17191732 minLength: 1
17201733
1721 - `type: "text"`
1722
17231734 - `cache_control: optional BetaCacheControlEphemeral or null`
17241735
17251736 Create a cache control breakpoint at this content block.
from line 1747
17361747
17371748 - `BetaThinkingConfigEnabled object`
17381749
1750 - `type: "enabled"`
1751
17391752 - `budget_tokens: number`
17401753
17411754 Determines how many tokens Claude can use for its internal reasoning process. Larger budgets can enable more thorough analysis for complex problems, improving response quality.
from line 1758
17451758 See [extended thinking](https://platform.claude.com/docs/en/build-with-claude/extended-thinking) for details.
17461759
17471760 minimum: 1024
1748
1749 - `type: "enabled"`
17501761
17511762 - `block_binding: optional BetaThinkingBlockBinding or null`
17521763
from line 1843
18321843
18331844 The model will use the specified tool with `tool_choice.name`.
18341845
1846 - `type: "tool"`
1847
18351848 - `name: string`
18361849
18371850 The name of the tool to use.
1838
1839 - `type: "tool"`
18401851
18411852 - `disable_parallel_tool_use: optional boolean`
18421853
from line 1927
19161927
19171928 - `BetaTool object`
19181929
1930 - `type: optional "custom" or null`
1931
19191932 - `input_schema: object`
19201933
19211934 [JSON schema](https://json-schema.org/draft/2020-12) for this tool's input.
from line 1983
19701983
19711984 When true, guarantees schema validation on tool names and inputs
19721985
1973 - `type: optional "custom" or null`
1974
19751986 - `BetaToolBash20241022 object`
19761987
1988 - `type: "bash_20241022"`
1989
19771990 - `name: "bash"`
19781991
19791992 Name of the tool.
19801993
19811994 This is how the tool will be called by the model and in `tool_use` blocks.
19821995
1983 - `type: "bash_20241022"`
1984
19851996 - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120" or "code_execution_20260521"`
19861997
19871998 - `"direct"`
from line 2019
20082019
20092020 - `BetaToolBash20250124 object`
20102021
2022 - `type: "bash_20250124"`
2023
20112024 - `name: "bash"`
20122025
20132026 Name of the tool.
20142027
20152028 This is how the tool will be called by the model and in `tool_use` blocks.
20162029
2017 - `type: "bash_20250124"`
2018
20192030 - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120" or "code_execution_20260521"`
20202031
20212032 - `"direct"`
from line 2053
20422053
20432054 - `BetaCodeExecutionTool20250522 object`
20442055
2056 - `type: "code_execution_20250522"`
2057
20452058 - `name: "code_execution"`
20462059
20472060 Name of the tool.
20482061
20492062 This is how the tool will be called by the model and in `tool_use` blocks.
20502063
2051 - `type: "code_execution_20250522"`
2052
20532064 - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120" or "code_execution_20260521"`
20542065
20552066 - `"direct"`
from line 2085
20742085
20752086 - `BetaCodeExecutionTool20250825 object`
20762087
2088 - `type: "code_execution_20250825"`
2089
20772090 - `name: "code_execution"`
20782091
20792092 Name of the tool.
20802093
20812094 This is how the tool will be called by the model and in `tool_use` blocks.
20822095
2083 - `type: "code_execution_20250825"`
2084
20852096 - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120" or "code_execution_20260521"`
20862097
20872098 - `"direct"`
from line 2119
21082119
21092120 Code execution tool with REPL state persistence (daemon mode + gVisor checkpoint).
21102121
2122 - `type: "code_execution_20260120"`
2123
21112124 - `name: "code_execution"`
21122125
21132126 Name of the tool.
21142127
21152128 This is how the tool will be called by the model and in `tool_use` blocks.
21162129
2117 - `type: "code_execution_20260120"`
2118
21192130 - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120" or "code_execution_20260521"`
21202131
21212132 - `"direct"`
from line 2153
21422153
21432154 Code execution tool with REPL state persistence.
21442155
2156 - `type: "code_execution_20260521"`
2157
21452158 - `name: "code_execution"`
21462159
21472160 Name of the tool.
21482161
21492162 This is how the tool will be called by the model and in `tool_use` blocks.
2150
2151 - `type: "code_execution_20260521"`
21522163
21532164 - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120" or "code_execution_20260521"`
21542165
from line 2205
21942205 absent. Unknown keys are rejected: the field set is this toolset
21952206 version's complete member set.
21962207
2208 - `type: optional BetaBrowserTypeConfig or null`
2209
2210 `type`'s config overrides.
2211
2212 - `defer_loading: optional boolean or null`
2213
2214 Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.
2215
2216 - `enabled: optional boolean or null`
2217
2218 Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.
2219
21972220 - `close_tab: optional BetaBrowserCloseTabConfig or null`
21982221
21992222 `close_tab`'s config overrides.
from line 2553
25302553
25312554 Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.
25322555
2533 - `type: optional BetaBrowserTypeConfig or null`
2534
2535 `type`'s config overrides.
2536
2537 - `defer_loading: optional boolean or null`
2538
2539 Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.
2540
2541 - `enabled: optional boolean or null`
2542
2543 Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.
2544
25452556 - `wait: optional BetaBrowserWaitConfig or null`
25462557
25472558 `wait`'s config overrides.
from line 2579
25682579
25692580 - `BetaToolComputerUse20241022 object`
25702581
2582 - `type: "computer_20241022"`
2583
25712584 - `display_height_px: number`
25722585
25732586 The height of the display in pixels.
from line 2599
25862599
25872600 This is how the tool will be called by the model and in `tool_use` blocks.
25882601
2589 - `type: "computer_20241022"`
2590
25912602 - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120" or "code_execution_20260521"`
25922603
25932604 - `"direct"`
from line 2631
26202631
26212632 - `BetaMemoryTool20250818 object`
26222633
2634 - `type: "memory_20250818"`
2635
26232636 - `name: "memory"`
26242637
26252638 Name of the tool.
26262639
26272640 This is how the tool will be called by the model and in `tool_use` blocks.
26282641
2629 - `type: "memory_20250818"`
2630
26312642 - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120" or "code_execution_20260521"`
26322643
26332644 - `"direct"`
from line 2665
26542665
26552666 - `BetaToolComputerUse20250124 object`
26562667
2668 - `type: "computer_20250124"`
2669
26572670 - `display_height_px: number`
26582671
26592672 The height of the display in pixels.
from line 2685
26722685
26732686 This is how the tool will be called by the model and in `tool_use` blocks.
26742687
2675 - `type: "computer_20250124"`
2676
26772688 - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120" or "code_execution_20260521"`
26782689
26792690 - `"direct"`
from line 2717
27062717
27072718 - `BetaToolTextEditor20241022 object`
27082719
2720 - `type: "text_editor_20241022"`
2721
27092722 - `name: "str_replace_editor"`
27102723
27112724 Name of the tool.
27122725
27132726 This is how the tool will be called by the model and in `tool_use` blocks.
27142727
2715 - `type: "text_editor_20241022"`
2716
27172728 - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120" or "code_execution_20260521"`
27182729
27192730 - `"direct"`
from line 2751
27402751
27412752 - `BetaToolComputerUse20251124 object`
27422753
2754 - `type: "computer_20251124"`
2755
27432756 - `display_height_px: number`
27442757
27452758 The height of the display in pixels.
from line 2770
27572770 Name of the tool.
27582771
27592772 This is how the tool will be called by the model and in `tool_use` blocks.
2760
2761 - `type: "computer_20251124"`
27622773
27632774 - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120" or "code_execution_20260521"`
27642775
from line 2831
28202831 absent. Unknown keys are rejected: the field set is this toolset
28212832 version's complete member set.
28222833
2834 - `type: optional BetaComputerTypeConfig or null`
2835
2836 `type`'s config overrides.
2837
2838 - `defer_loading: optional boolean or null`
2839
2840 Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.
2841
2842 - `enabled: optional boolean or null`
2843
2844 Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.
2845
28232846 - `cursor_position: optional BetaComputerCursorPositionConfig or null`
28242847
28252848 `cursor_position`'s config overrides.
from line 3011
29883011
29893012 Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.
29903013
2991 - `type: optional BetaComputerTypeConfig or null`
2992
2993 `type`'s config overrides.
2994
2995 - `defer_loading: optional boolean or null`
2996
2997 Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.
2998
2999 - `enabled: optional boolean or null`
3000
3001 Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.
3002
30033014 - `wait: optional BetaComputerWaitConfig or null`
30043015
30053016 `wait`'s config overrides.
from line 3037
30263037
30273038 - `BetaToolTextEditor20250124 object`
30283039
3040 - `type: "text_editor_20250124"`
3041
30293042 - `name: "str_replace_editor"`
30303043
30313044 Name of the tool.
30323045
30333046 This is how the tool will be called by the model and in `tool_use` blocks.
30343047
3035 - `type: "text_editor_20250124"`
3036
30373048 - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120" or "code_execution_20260521"`
30383049
30393050 - `"direct"`
from line 3071
30603071
30613072 - `BetaToolTextEditor20250429 object`
30623073
3074 - `type: "text_editor_20250429"`
3075
30633076 - `name: "str_replace_based_edit_tool"`
30643077
30653078 Name of the tool.
30663079
30673080 This is how the tool will be called by the model and in `tool_use` blocks.
30683081
3069 - `type: "text_editor_20250429"`
3070
30713082 - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120" or "code_execution_20260521"`
30723083
30733084 - `"direct"`
from line 3105
30943105
30953106 - `BetaToolTextEditor20250728 object`
30963107
3108 - `type: "text_editor_20250728"`
3109
30973110 - `name: "str_replace_based_edit_tool"`
30983111
30993112 Name of the tool.
31003113
31013114 This is how the tool will be called by the model and in `tool_use` blocks.
31023115
3103 - `type: "text_editor_20250728"`
3104
31053116 - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120" or "code_execution_20260521"`
31063117
31073118 - `"direct"`
from line 3145
31343145
31353146 - `BetaWebSearchTool20250305 object`
31363147
3148 - `type: "web_search_20250305"`
3149
31373150 - `name: "web_search"`
31383151
31393152 Name of the tool.
31403153
31413154 This is how the tool will be called by the model and in `tool_use` blocks.
31423155
3143 - `type: "web_search_20250305"`
3144
31453156 - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120" or "code_execution_20260521"`
31463157
31473158 - `"direct"`
from line 3221
32103221
32113222 - `BetaWebFetchTool20250910 object`
32123223
3224 - `type: "web_fetch_20250910"`
3225
32133226 - `name: "web_fetch"`
32143227
32153228 Name of the tool.
32163229
32173230 This is how the tool will be called by the model and in `tool_use` blocks.
32183231
3219 - `type: "web_fetch_20250910"`
3220
32213232 - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120" or "code_execution_20260521"`
32223233
32233234 - `"direct"`
from line 3277
32663277
32673278 - `BetaWebSearchTool20260209 object`
32683279
3280 - `type: "web_search_20260209"`
3281
32693282 - `name: "web_search"`
32703283
32713284 Name of the tool.
32723285
32733286 This is how the tool will be called by the model and in `tool_use` blocks.
32743287
3275 - `type: "web_search_20260209"`
3276
32773288 - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120" or "code_execution_20260521"`
32783289
32793290 - `"direct"`
from line 3327
33163327
33173328 - `BetaWebFetchTool20260209 object`
33183329
3330 - `type: "web_fetch_20260209"`
3331
33193332 - `name: "web_fetch"`
33203333
33213334 Name of the tool.
33223335
33233336 This is how the tool will be called by the model and in `tool_use` blocks.
33243337
3325 - `type: "web_fetch_20260209"`
3326
33273338 - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120" or "code_execution_20260521"`
33283339
33293340 - `"direct"`
from line 3385
33743385
33753386 Web fetch tool with use_cache parameter for bypassing cached content.
33763387
3388 - `type: "web_fetch_20260309"`
3389
33773390 - `name: "web_fetch"`
33783391
33793392 Name of the tool.
33803393
33813394 This is how the tool will be called by the model and in `tool_use` blocks.
33823395
3383 - `type: "web_fetch_20260309"`
3384
33853396 - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120" or "code_execution_20260521"`
33863397
33873398 - `"direct"`
from line 3445
34343445
34353446 - `BetaWebSearchTool20260318 object`
34363447
3448 - `type: "web_search_20260318"`
3449
34373450 - `name: "web_search"`
34383451
34393452 Name of the tool.
34403453
34413454 This is how the tool will be called by the model and in `tool_use` blocks.
34423455
3443 - `type: "web_search_20260318"`
3444
34453456 - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120" or "code_execution_20260521"`
34463457
34473458 - `"direct"`
from line 3503
34923503
34933504 - `BetaWebFetchTool20260318 object`
34943505
3506 - `type: "web_fetch_20260318"`
3507
34953508 - `name: "web_fetch"`
34963509
34973510 Name of the tool.
34983511
34993512 This is how the tool will be called by the model and in `tool_use` blocks.
35003513
3501 - `type: "web_fetch_20260318"`
3502
35033514 - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120" or "code_execution_20260521"`
35043515
35053516 - `"direct"`
from line 3571
35603571
35613572 - `BetaAdvisorTool20260301 object`
35623573
3574 - `type: "advisor_20260301"`
3575
35633576 - `model: Model`
35643577
35653578 The model that will complete your prompt.
from line 3585
35723585
35733586 This is how the tool will be called by the model and in `tool_use` blocks.
35743587
3575 - `type: "advisor_20260301"`
3576
35773588 - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120" or "code_execution_20260521"`
35783589
35793590 - `"direct"`
from line 3625
36143625
36153626 - `BetaToolSearchToolBm25_20251119 object`
36163627
3628 - `type: "tool_search_tool_bm25_20251119" or "tool_search_tool_bm25"`
3629
3630 - `"tool_search_tool_bm25_20251119"`
3631
3632 - `"tool_search_tool_bm25"`
3633
36173634 - `name: "tool_search_tool_bm25"`
36183635
36193636 Name of the tool.
36203637
36213638 This is how the tool will be called by the model and in `tool_use` blocks.
36223639
3623 - `type: "tool_search_tool_bm25_20251119" or "tool_search_tool_bm25"`
3624
3625 - `"tool_search_tool_bm25_20251119"`
3626
3627 - `"tool_search_tool_bm25"`
3628
36293640 - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120" or "code_execution_20260521"`
36303641
36313642 - `"direct"`
from line 3661
36503661
36513662 - `BetaToolSearchToolRegex20251119 object`
36523663
3664 - `type: "tool_search_tool_regex_20251119" or "tool_search_tool_regex"`
3665
3666 - `"tool_search_tool_regex_20251119"`
3667
3668 - `"tool_search_tool_regex"`
3669
36533670 - `name: "tool_search_tool_regex"`
36543671
36553672 Name of the tool.
36563673
36573674 This is how the tool will be called by the model and in `tool_use` blocks.
3658
3659 - `type: "tool_search_tool_regex_20251119" or "tool_search_tool_regex"`
3660
3661 - `"tool_search_tool_regex_20251119"`
3662
3663 - `"tool_search_tool_regex"`
36643675
36653676 - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120" or "code_execution_20260521"`
36663677
from line 3702
36913702 Allows configuring enabled status and defer_loading for all tools
36923703 from an MCP server, with optional per-tool overrides.
36933704
3705 - `type: "mcp_toolset"`
3706
36943707 - `mcp_server_name: string`
36953708
36963709 Name of the MCP server to configure tools for
36973710
36983711 maxLength: 255, minLength: 1
3699
3700 - `type: "mcp_toolset"`
37013712
37023713 - `cache_control: optional BetaCacheControlEphemeral or null`
37033714
37043715