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
6## Count tokens in a Message
7
8**post** `/v1/messages/count_tokens`
1# Count tokens in a Message
2
3**POST** `/v1/messages/count_tokens`
94
105Count the number of tokens in a Message.
116
from line 8
138
149Learn more about token counting in our [user guide](https://platform.claude.com/docs/en/build-with-claude/token-counting)
1510
16### Header Parameters
11## Headers
1712
1813- `"anthropic-beta": optional array of AnthropicBeta`
1914
from line 90
9590
9691 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.
9792
98### Body Parameters
93## Body parameters
9994
10095- `messages: array of BetaMessageParam`
10196
from line 149
154149
155150 - `array of BetaContentBlockParam`
156151
157 - `BetaTextBlockParam object { text, type, cache_control, citations }`
152 - `BetaTextBlockParam object`
158153
159154 - `text: string`
160155
156 minLength: 1
157
161158 - `type: "text"`
162159
163 - `"text"`
164
165160 - `cache_control: optional BetaCacheControlEphemeral or null`
166161
167162 Create a cache control breakpoint at this content block.
168163
169164 - `type: "ephemeral"`
170
171 - `"ephemeral"`
172165
173166 - `ttl: optional "5m" or "1h"`
174167
from line 180
187180
188181 - `citations: optional array of BetaTextCitationParam or null`
189182
190 - `BetaCitationCharLocationParam object { cited_text, document_index, document_title, 3 more }`
183 - `BetaCitationCharLocationParam object`
191184
192185 - `cited_text: string`
193186
194187 - `document_index: number`
195188
189 minimum: 0
190
196191 - `document_title: string or null`
197192
193 maxLength: 500, minLength: 1
194
198195 - `end_char_index: number`
199196
200197 - `start_char_index: number`
201198
199 minimum: 0
200
202201 - `type: "char_location"`
203202
204 - `"char_location"`
205
206 - `BetaCitationPageLocationParam object { cited_text, document_index, document_title, 3 more }`
203 - `BetaCitationPageLocationParam object`
207204
208205 - `cited_text: string`
209206
210207 - `document_index: number`
211208
209 minimum: 0
210
212211 - `document_title: string or null`
213212
213 maxLength: 500, minLength: 1
214
214215 - `end_page_number: number`
215216
216217 - `start_page_number: number`
217218
219 minimum: 1
220
218221 - `type: "page_location"`
219222
220 - `"page_location"`
221
222 - `BetaCitationContentBlockLocationParam object { cited_text, document_index, document_title, 3 more }`
223 - `BetaCitationContentBlockLocationParam object`
223224
224225 - `cited_text: string`
225226
from line 230
229230
230231 - `document_index: number`
231232
233 minimum: 0
234
232235 - `document_title: string or null`
233236
237 maxLength: 500, minLength: 1
238
234239 - `end_block_index: number`
235240
236241 Exclusive 0-based end index of the cited block range in the source's `content` array.
from line 246
241246
242247 0-based index of the first cited block in the source's `content` array.
243248
249 minimum: 0
250
244251 - `type: "content_block_location"`
245252
246 - `"content_block_location"`
247
248 - `BetaCitationWebSearchResultLocationParam object { cited_text, encrypted_index, title, 2 more }`
253 - `BetaCitationWebSearchResultLocationParam object`
249254
250255 - `cited_text: string`
251256
from line 258
253258
254259 - `title: string or null`
255260
261 maxLength: 512, minLength: 1
262
256263 - `type: "web_search_result_location"`
257264
258 - `"web_search_result_location"`
259
260265 - `url: string`
261266
262 - `BetaCitationSearchResultLocationParam object { cited_text, end_block_index, search_result_index, 4 more }`
267 minLength: 1
268
269 - `BetaCitationSearchResultLocationParam object`
263270
264271 - `cited_text: string`
265272
from line 286
279286
280287 Counted separately from `document_index`; server-side web search results are not included in this count.
281288
289 minimum: 0
290
282291 - `source: string`
283292
284293 - `start_block_index: number`
285294
286295 0-based index of the first cited block in the source's `content` array.
287296
297 minimum: 0
298
288299 - `title: string or null`
289300
290301 - `type: "search_result_location"`
291302
292 - `"search_result_location"`
293
294 - `BetaImageBlockParam object { source, type, cache_control, transformations }`
303 - `BetaImageBlockParam object`
295304
296305 - `source: BetaBase64ImageSource or BetaURLImageSource or BetaFileImageSource`
297306
298 - `BetaBase64ImageSource object { data, media_type, type }`
307 - `BetaBase64ImageSource object`
299308
300309 - `data: string`
301310
311 format: byte
312
302313 - `media_type: "image/jpeg" or "image/png" or "image/gif" or "image/webp"`
303314
304315 - `"image/jpeg"`
from line 322
311322
312323 - `type: "base64"`
313324
314 - `"base64"`
315
316 - `BetaURLImageSource object { type, url }`
325 - `BetaURLImageSource object`
317326
318327 - `type: "url"`
319328
320 - `"url"`
321
322329 - `url: string`
323330
324 - `BetaFileImageSource object { file_id, type }`
331 - `BetaFileImageSource object`
325332
326333 - `file_id: string`
327334
328335 - `type: "file"`
329336
330 - `"file"`
331
332337 - `type: "image"`
333338
334 - `"image"`
335
336339 - `cache_control: optional BetaCacheControlEphemeral or null`
337340
338341 Create a cache control breakpoint at this content block.
from line 352
349352
350353 - `"error"`
351354
352 - `BetaRequestDocumentBlock object { source, type, cache_control, 3 more }`
355 - `BetaRequestDocumentBlock object`
353356
354357 - `source: BetaBase64PDFSource or BetaPlainTextSource or BetaContentBlockSource or 2 more`
355358
356 - `BetaBase64PDFSource object { data, media_type, type }`
359 - `BetaBase64PDFSource object`
357360
358361 - `data: string`
359362
363 format: byte
364
360365 - `media_type: "application/pdf"`
361366
362 - `"application/pdf"`
363
364367 - `type: "base64"`
365368
366 - `"base64"`
367
368 - `BetaPlainTextSource object { data, media_type, type }`
369 - `BetaPlainTextSource object`
369370
370371 - `data: string`
371372
372373 - `media_type: "text/plain"`
373374
374 - `"text/plain"`
375
376375 - `type: "text"`
377376
378 - `"text"`
379
380 - `BetaContentBlockSource object { content, type }`
377 - `BetaContentBlockSource object`
381378
382379 - `content: string or array of BetaContentBlockSourceContent`
383380
from line 382
385382
386383 - `BetaContentBlockSourceContent = array of BetaContentBlockSourceContent`
387384
388 - `BetaTextBlockParam object { text, type, cache_control, citations }`
389
390 - `BetaImageBlockParam object { source, type, cache_control, transformations }`
385 - `BetaTextBlockParam object`
386
387 - `BetaImageBlockParam object`
391388
392389 - `type: "content"`
393390
394 - `"content"`
395
396 - `BetaURLPDFSource object { type, url }`
391 - `BetaURLPDFSource object`
397392
398393 - `type: "url"`
399394
400 - `"url"`
401
402395 - `url: string`
403396
404 - `BetaFileDocumentSource object { file_id, type }`
397 - `BetaFileDocumentSource object`
405398
406399 - `file_id: string`
407400
408401 - `type: "file"`
409402
410 - `"file"`
411
412403 - `type: "document"`
413404
414 - `"document"`
415
416405 - `cache_control: optional BetaCacheControlEphemeral or null`
417406
418407 Create a cache control breakpoint at this content block.
from line 412
423412
424413 - `context: optional string or null`
425414
415 minLength: 1
416
426417 - `title: optional string or null`
427418
428 - `BetaSearchResultBlockParam object { content, source, title, 3 more }`
419 maxLength: 500, minLength: 1
420
421 - `BetaSearchResultBlockParam object`
429422
430423 - `content: array of BetaTextBlockParam`
431424
432425 - `text: string`
433426
427 minLength: 1
428
434429 - `type: "text"`
435430
436431 - `cache_control: optional BetaCacheControlEphemeral or null`
from line 440
445440
446441 - `type: "search_result"`
447442
448 - `"search_result"`
449
450443 - `cache_control: optional BetaCacheControlEphemeral or null`
451444
452445 Create a cache control breakpoint at this content block.
453446
454447 - `citations: optional BetaCitationsConfigParam`
455448
456 - `BetaThinkingBlockParam object { signature, thinking, type }`
449 - `BetaThinkingBlockParam object`
457450
458451 - `signature: string`
459452
from line 460
467460
468461 - `type: "thinking"`
469462
470 - `"thinking"`
471
472 - `BetaRedactedThinkingBlockParam object { data, type }`
463 - `BetaRedactedThinkingBlockParam object`
473464
474465 - `data: string`
475466
from line 468
477468
478469 - `type: "redacted_thinking"`
479470
480 - `"redacted_thinking"`
481
482 - `BetaToolUseBlockParam object { id, input, name, 4 more }`
471 - `BetaToolUseBlockParam object`
483472
484473 - `id: string`
485474
475 pattern: ^[a-zA-Z0-9_-]+$
476
486477 - `input: map[unknown]`
487478
488479 - `name: string`
489480
481 maxLength: 200, minLength: 1
482
490483 - `type: "tool_use"`
491484
492 - `"tool_use"`
493
494485 - `cache_control: optional BetaCacheControlEphemeral or null`
495486
496487 Create a cache control breakpoint at this content block.
from line 490
499490
500491 Tool invocation directly from the model.
501492
502 - `BetaDirectCaller object { type }`
493 - `BetaDirectCaller object`
503494
504495 Tool invocation directly from the model.
505496
506497 - `type: "direct"`
507498
508 - `"direct"`
509
510 - `BetaServerToolCaller object { tool_id, type }`
499 - `BetaServerToolCaller object`
511500
512501 Tool invocation generated by a server-side tool.
513502
514503 - `tool_id: string`
515504
505 pattern: ^srvtoolu_[a-zA-Z0-9_]+$
506
516507 - `type: "code_execution_20250825"`
517508
518 - `"code_execution_20250825"`
519
520 - `BetaServerToolCaller20260120 object { tool_id, type }`
509 - `BetaServerToolCaller20260120 object`
521510
522511 - `tool_id: string`
523512
513 pattern: ^srvtoolu_[a-zA-Z0-9_]+$
514
524515 - `type: "code_execution_20260120"`
525516
526 - `"code_execution_20260120"`
527
528517 - `toolset_name: optional string or null`
529518
530519 For a toolset member tool_use, the toolset family this member belongs to.
531520
532 - `BetaToolResultBlockParam object { tool_use_id, type, cache_control, 3 more }`
521 maxLength: 64, minLength: 1, pattern: ^[a-zA-Z0-9_-]+$
522
523 - `BetaToolResultBlockParam object`
533524
534525 - `tool_use_id: string`
535526
527 pattern: ^[a-zA-Z0-9_-]+$
528
536529 - `type: "tool_result"`
537530
538 - `"tool_result"`
539
540531 - `cache_control: optional BetaCacheControlEphemeral or null`
541532
542533 Create a cache control breakpoint at this content block.
from line 538
547538
548539 - `array of BetaTextBlockParam or BetaImageBlockParam or BetaSearchResultBlockParam or 3 more`
549540
550 - `BetaTextBlockParam object { text, type, cache_control, citations }`
551
552 - `BetaImageBlockParam object { source, type, cache_control, transformations }`
553
554 - `BetaSearchResultBlockParam object { content, source, title, 3 more }`
555
556 - `BetaRequestDocumentBlock object { source, type, cache_control, 3 more }`
557
558 - `BetaToolReferenceBlockParam object { tool_name, type, cache_control }`
541 - `BetaTextBlockParam object`
542
543 - `BetaImageBlockParam object`
544
545 - `BetaSearchResultBlockParam object`
546
547 - `BetaRequestDocumentBlock object`
548
549 - `BetaToolReferenceBlockParam object`
559550
560551 Tool reference block that can be included in tool_result content.
561552
562553 - `tool_name: string`
563554
555 maxLength: 256, minLength: 1, pattern: ^[a-zA-Z0-9_-]{1,256}$
556
564557 - `type: "tool_reference"`
565558
566 - `"tool_reference"`
567
568559 - `cache_control: optional BetaCacheControlEphemeral or null`
569560
570561 Create a cache control breakpoint at this content block.
571562
572 - `BetaBrowserStateBlockParam object { tabs, type, cache_control, state_changes }`
563 - `BetaBrowserStateBlockParam object`
573564
574565 The caller's browser state after a browser toolset member call —
575566 the full inventory of open tabs, which tab is active, and any side
from line 574
583574
584575 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`.
585576
577 maxItems: 100
578
586579 - `tab_id: string`
587580
588581 The caller-assigned identifier for this tab, unique within the inventory.
589582
583 maxLength: 4096, minLength: 1, pattern: ^[^\x00-\x1f\x7f-\x9f\u2028\u2029]*$
584
590585 - `title: string`
591586
592587 The title of the page the tab is showing. May be empty.
593588
589 maxLength: 4096, pattern: ^[^\x00-\x1f\x7f-\x9f\u2028\u2029]*$
590
594591 - `url: string`
595592
596593 The URL of the page the tab is showing. May be empty.
597594
595 maxLength: 4096, pattern: ^[^\x00-\x1f\x7f-\x9f\u2028\u2029]*$
596
598597 - `active: optional boolean`
599598
600599 Whether this tab is the active tab after this call. Whenever `tabs` is non-empty, exactly one entry is marked `active: true`.
601600
602601 - `type: "browser_state"`
603602
604 - `"browser_state"`
605
606603 - `cache_control: optional BetaCacheControlEphemeral or null`
607604
608605 Create a cache control breakpoint at this content block.
from line 608
611608
612609 Tabs opened and download state changes during this call. "Nothing to report" is expressed by omitting the field, never by an empty list.
613610
614 - `BetaBrowserStateChangeTabOpened object { tab_id, type }`
611 maxItems: 200, minItems: 1
612
613 - `BetaBrowserStateChangeTabOpened object`
615614
616615 A tab this call's execution opened that remains open at its end —
617616 the creation delta of the `tabs` inventory, not an event log.
from line 624
625624
626625 The `tab_id` of the opened tab, present in `tabs`.
627626
627 maxLength: 4096, minLength: 1, pattern: ^[^\x00-\x1f\x7f-\x9f\u2028\u2029]*$
628
628629 - `type: "tab_opened"`
629630
630 - `"tab_opened"`
631
632 - `BetaBrowserStateChangeDownloadStarted object { download_id, type, url }`
631 - `BetaBrowserStateChangeDownloadStarted object`
633632
634633 A file download that started during this call.
635634
from line 636
637636
638637 The caller-assigned identifier for this download, stable across the state changes reporting it.
639638
639 maxLength: 4096, minLength: 1, pattern: ^[^\x00-\x1f\x7f-\x9f\u2028\u2029]*$
640
640641 - `type: "download_started"`
641642
642 - `"download_started"`
643
644643 - `url: string`
645644
646645 The final post-redirect URL the download was served from.
647646
648 - `BetaBrowserStateChangeDownloadCompleted object { download_id, type, url, 2 more }`
647 maxLength: 4096, pattern: ^[^\x00-\x1f\x7f-\x9f\u2028\u2029]*$
648
649 - `BetaBrowserStateChangeDownloadCompleted object`
649650
650651 A file download that finished during this call, reported with the
651652 same `download_id` as its `download_started` — or without a prior
from line 657
656657
657658 The caller-assigned identifier for this download, stable across the state changes reporting it.
658659
660 maxLength: 4096, minLength: 1, pattern: ^[^\x00-\x1f\x7f-\x9f\u2028\u2029]*$
661
659662 - `type: "download_completed"`
660663
661 - `"download_completed"`
662
663664 - `url: string`
664665
665666 The final post-redirect URL the download was served from.
666667
668 maxLength: 4096, pattern: ^[^\x00-\x1f\x7f-\x9f\u2028\u2029]*$
669
667670 - `path: optional string or null`
668671
669672 Where the executor saved the file, on the executor's filesystem. Only included when another tool in the same environment can read the file at that path.
670673
674 pattern: ^[^\x00-\x1f\x7f-\x9f\u2028\u2029]*$, maxLength: 4096
675
671676 - `size_bytes: optional number or null`
672677
673678 The completed download's size.
674679
675 - `BetaBrowserStateChangeDownloadFailed object { download_id, type, url, error }`
680 minimum: 0
681
682 - `BetaBrowserStateChangeDownloadFailed object`
676683
677684 A file download that failed — or was cancelled — during this call.
678685
from line 687
680687
681688 The caller-assigned identifier for this download, stable across the state changes reporting it.
682689
690 maxLength: 4096, minLength: 1, pattern: ^[^\x00-\x1f\x7f-\x9f\u2028\u2029]*$
691
683692 - `type: "download_failed"`
684693
685 - `"download_failed"`
686
687694 - `url: string`
688695
689696 The final post-redirect URL the download was served from.
690697
698 maxLength: 4096, pattern: ^[^\x00-\x1f\x7f-\x9f\u2028\u2029]*$
699
691700 - `error: optional string or null`
692701
693702 The failure or cancellation detail, when known.
694703
704 pattern: ^[^\x00-\x1f\x7f-\x9f\u2028\u2029]*$, maxLength: 4096
705
695706 - `is_error: optional boolean`
696707
697708 - `toolset_name: optional string or null`
698709
699710 For a toolset member tool_result, the toolset family of the paired tool_use.
700711
701 - `BetaServerToolUseBlockParam object { id, input, name, 3 more }`
712 maxLength: 64, minLength: 1, pattern: ^[a-zA-Z0-9_-]+$
713
714 - `BetaServerToolUseBlockParam object`
702715
703716 - `id: string`
704717
718 pattern: ^srvtoolu_[a-zA-Z0-9_]+$
719
705720 - `input: map[unknown]`
706721
707722 - `name: "advisor" or "web_search" or "web_fetch" or 5 more`
from line 739
724739
725740 - `type: "server_tool_use"`
726741
727 - `"server_tool_use"`
728
729742 - `cache_control: optional BetaCacheControlEphemeral or null`
730743
731744 Create a cache control breakpoint at this content block.
from line 747
734747
735748 Tool invocation directly from the model.
736749
737 - `BetaDirectCaller object { type }`
750 - `BetaDirectCaller object`
738751
739752 Tool invocation directly from the model.
740753
741 - `BetaServerToolCaller object { tool_id, type }`
754 - `BetaServerToolCaller object`
742755
743756 Tool invocation generated by a server-side tool.
744757
745 - `BetaServerToolCaller20260120 object { tool_id, type }`
746
747 - `BetaWebSearchToolResultBlockParam object { content, tool_use_id, type, 2 more }`
758 - `BetaServerToolCaller20260120 object`
759
760 - `BetaWebSearchToolResultBlockParam object`
748761
749762 - `content: BetaWebSearchToolResultBlockParamContent`
750763
from line 769
756769
757770 - `type: "web_search_result"`
758771
759 - `"web_search_result"`
760
761772 - `url: string`
762773
763774 - `page_age: optional string or null`
764775
765 - `BetaWebSearchToolRequestError object { error_code, type }`
776 - `BetaWebSearchToolRequestError object`
766777
767778 - `error_code: BetaWebSearchToolResultErrorCode`
768779
from line 791
780791
781792 - `type: "web_search_tool_result_error"`
782793
783 - `"web_search_tool_result_error"`
784
785794 - `tool_use_id: string`
786795
796 pattern: ^srvtoolu_[a-zA-Z0-9_]+$
797
787798 - `type: "web_search_tool_result"`
788799
789 - `"web_search_tool_result"`
790
791800 - `cache_control: optional BetaCacheControlEphemeral or null`
792801
793802 Create a cache control breakpoint at this content block.
from line 805
796805
797806 Tool invocation directly from the model.
798807
799 - `BetaDirectCaller object { type }`
808 - `BetaDirectCaller object`
800809
801810 Tool invocation directly from the model.
802811
803 - `BetaServerToolCaller object { tool_id, type }`
812 - `BetaServerToolCaller object`
804813
805814 Tool invocation generated by a server-side tool.
806815
807 - `BetaServerToolCaller20260120 object { tool_id, type }`
808
809 - `BetaWebFetchToolResultBlockParam object { content, tool_use_id, type, 2 more }`
816 - `BetaServerToolCaller20260120 object`
817
818 - `BetaWebFetchToolResultBlockParam object`
810819
811820 - `content: BetaWebFetchToolResultErrorBlockParam or BetaWebFetchBlockParam`
812821
813 - `BetaWebFetchToolResultErrorBlockParam object { error_code, type }`
822 - `BetaWebFetchToolResultErrorBlockParam object`
814823
815824 - `error_code: BetaWebFetchToolResultErrorCode`
816825
from line 843
834843
835844 - `type: "web_fetch_tool_result_error"`
836845
837 - `"web_fetch_tool_result_error"`
838
839 - `BetaWebFetchBlockParam object { content, type, url, retrieved_at }`
846 - `BetaWebFetchBlockParam object`
840847
841848 - `content: BetaRequestDocumentBlock`
842849
843850 - `type: "web_fetch_result"`
844851
845 - `"web_fetch_result"`
846
847852 - `url: string`
848853
849854 Fetched content URL
from line 859
854859
855860 - `tool_use_id: string`
856861
862 pattern: ^srvtoolu_[a-zA-Z0-9_]+$
863
857864 - `type: "web_fetch_tool_result"`
858865
859 - `"web_fetch_tool_result"`
860
861866 - `cache_control: optional BetaCacheControlEphemeral or null`
862867
863868 Create a cache control breakpoint at this content block.
from line 871
866871
867872 Tool invocation directly from the model.
868873
869 - `BetaDirectCaller object { type }`
874 - `BetaDirectCaller object`
870875
871876 Tool invocation directly from the model.
872877
873 - `BetaServerToolCaller object { tool_id, type }`
878 - `BetaServerToolCaller object`
874879
875880 Tool invocation generated by a server-side tool.
876881
877 - `BetaServerToolCaller20260120 object { tool_id, type }`
878
879 - `BetaAdvisorToolResultBlockParam object { content, tool_use_id, type, cache_control }`
882 - `BetaServerToolCaller20260120 object`
883
884 - `BetaAdvisorToolResultBlockParam object`
880885
881886 - `content: BetaAdvisorToolResultErrorParam or BetaAdvisorResultBlockParam or BetaAdvisorRedactedResultBlockParam`
882887
883 - `BetaAdvisorToolResultErrorParam object { error_code, type }`
888 - `BetaAdvisorToolResultErrorParam object`
884889
885890 - `error_code: "max_uses_exceeded" or "prompt_too_long" or "too_many_requests" or 4 more`
886891
from line 905
900905
901906 - `type: "advisor_tool_result_error"`
902907
903 - `"advisor_tool_result_error"`
904
905 - `BetaAdvisorResultBlockParam object { text, type, stop_reason }`
908 - `BetaAdvisorResultBlockParam object`
906909
907910 - `text: string`
908911
909912 - `type: "advisor_result"`
910913
911 - `"advisor_result"`
912
913914 - `stop_reason: optional string or null`
914915
915 - `BetaAdvisorRedactedResultBlockParam object { encrypted_content, type, stop_reason }`
916 - `BetaAdvisorRedactedResultBlockParam object`
916917
917918 - `encrypted_content: string`
918919
from line 921
920921
921922 - `type: "advisor_redacted_result"`
922923
923 - `"advisor_redacted_result"`
924
925924 - `stop_reason: optional string or null`
926925
927926 - `tool_use_id: string`
928927
928 pattern: ^srvtoolu_[a-zA-Z0-9_]+$
929
929930 - `type: "advisor_tool_result"`
930931
931 - `"advisor_tool_result"`
932
933932 - `cache_control: optional BetaCacheControlEphemeral or null`
934933
935934 Create a cache control breakpoint at this content block.
936935
937 - `BetaCodeExecutionToolResultBlockParam object { content, tool_use_id, type, cache_control }`
936 - `BetaCodeExecutionToolResultBlockParam object`
938937
939938 - `content: BetaCodeExecutionToolResultBlockParamContent`
940939
941940 Code execution result with encrypted stdout for PFC + web_search results.
942941
943 - `BetaCodeExecutionToolResultErrorParam object { error_code, type }`
942 - `BetaCodeExecutionToolResultErrorParam object`
944943
945944 - `error_code: BetaCodeExecutionToolResultErrorCode`
946945
from line 953
954953
955954 - `type: "code_execution_tool_result_error"`
956955
957 - `"code_execution_tool_result_error"`
958
959 - `BetaCodeExecutionResultBlockParam object { content, return_code, stderr, 2 more }`
956 - `BetaCodeExecutionResultBlockParam object`
960957
961958 - `content: array of BetaCodeExecutionOutputBlockParam`
962959
from line 961
964961
965962 - `type: "code_execution_output"`
966963
967 - `"code_execution_output"`
968
969964 - `return_code: number`
970965
971966 - `stderr: string`
from line 969
974969
975970 - `type: "code_execution_result"`
976971
977 - `"code_execution_result"`
978
979 - `BetaEncryptedCodeExecutionResultBlockParam object { content, encrypted_stdout, return_code, 2 more }`
972 - `BetaEncryptedCodeExecutionResultBlockParam object`
980973
981974 Code execution result with encrypted stdout for PFC + web_search results.
982975
from line 987
994987
995988 - `type: "encrypted_code_execution_result"`
996989
997 - `"encrypted_code_execution_result"`
998
999990 - `tool_use_id: string`
1000991
992 pattern: ^srvtoolu_[a-zA-Z0-9_]+$
993
1001994 - `type: "code_execution_tool_result"`
1002995
1003 - `"code_execution_tool_result"`
1004
1005996 - `cache_control: optional BetaCacheControlEphemeral or null`
1006997
1007998 Create a cache control breakpoint at this content block.
1008999
1009 - `BetaBashCodeExecutionToolResultBlockParam object { content, tool_use_id, type, cache_control }`
1000 - `BetaBashCodeExecutionToolResultBlockParam object`
10101001
10111002 - `content: BetaBashCodeExecutionToolResultErrorParam or BetaBashCodeExecutionResultBlockParam`
10121003
1013 - `BetaBashCodeExecutionToolResultErrorParam object { error_code, type }`
1004 - `BetaBashCodeExecutionToolResultErrorParam object`
10141005
10151006 - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more`
10161007
from line 1017
10261017
10271018 - `type: "bash_code_execution_tool_result_error"`
10281019
1029 - `"bash_code_execution_tool_result_error"`
1030
1031 - `BetaBashCodeExecutionResultBlockParam object { content, return_code, stderr, 2 more }`
1020 - `BetaBashCodeExecutionResultBlockParam object`
10321021
10331022 - `content: array of BetaBashCodeExecutionOutputBlockParam`
10341023
from line 1025
10361025
10371026 - `type: "bash_code_execution_output"`
10381027
1039 - `"bash_code_execution_output"`
1040
10411028 - `return_code: number`
10421029
10431030 - `stderr: string`
from line 1033
10461033
10471034 - `type: "bash_code_execution_result"`
10481035
1049 - `"bash_code_execution_result"`
1050
10511036 - `tool_use_id: string`
10521037
1038 pattern: ^srvtoolu_[a-zA-Z0-9_]+$
1039
10531040 - `type: "bash_code_execution_tool_result"`
10541041
1055 - `"bash_code_execution_tool_result"`
1056
10571042 - `cache_control: optional BetaCacheControlEphemeral or null`
10581043
10591044 Create a cache control breakpoint at this content block.
10601045
1061 - `BetaTextEditorCodeExecutionToolResultBlockParam object { content, tool_use_id, type, cache_control }`
1046 - `BetaTextEditorCodeExecutionToolResultBlockParam object`
10621047
10631048 - `content: BetaTextEditorCodeExecutionToolResultErrorParam or BetaTextEditorCodeExecutionViewResultBlockParam or BetaTextEditorCodeExecutionCreateResultBlockParam or BetaTextEditorCodeExecutionStrReplaceResultBlockParam`
10641049
1065 - `BetaTextEditorCodeExecutionToolResultErrorParam object { error_code, type, error_message }`
1050 - `BetaTextEditorCodeExecutionToolResultErrorParam object`
10661051
10671052 - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more`
10681053
from line 1063
10781063
10791064 - `type: "text_editor_code_execution_tool_result_error"`
10801065
1081 - `"text_editor_code_execution_tool_result_error"`
1082
10831066 - `error_message: optional string or null`
10841067
1085 - `BetaTextEditorCodeExecutionViewResultBlockParam object { content, file_type, type, 3 more }`
1068 - `BetaTextEditorCodeExecutionViewResultBlockParam object`
10861069
10871070 - `content: string`
10881071
from line 1079
10961079
10971080 - `type: "text_editor_code_execution_view_result"`
10981081
1099 - `"text_editor_code_execution_view_result"`
1100
11011082 - `num_lines: optional number or null`
11021083
11031084 - `start_line: optional number or null`
11041085
11051086 - `total_lines: optional number or null`
11061087
1107 - `BetaTextEditorCodeExecutionCreateResultBlockParam object { is_file_update, type }`
1088 - `BetaTextEditorCodeExecutionCreateResultBlockParam object`
11081089
11091090 - `is_file_update: boolean`
11101091
11111092 - `type: "text_editor_code_execution_create_result"`
11121093
1113 - `"text_editor_code_execution_create_result"`
1114
1115 - `BetaTextEditorCodeExecutionStrReplaceResultBlockParam object { type, lines, new_lines, 3 more }`
1094 - `BetaTextEditorCodeExecutionStrReplaceResultBlockParam object`
11161095
11171096 - `type: "text_editor_code_execution_str_replace_result"`
11181097
1119 - `"text_editor_code_execution_str_replace_result"`
1120
11211098 - `lines: optional array of string or null`
11221099
11231100 - `new_lines: optional number or null`
from line 1107
11301107
11311108 - `tool_use_id: string`
11321109
1110 pattern: ^srvtoolu_[a-zA-Z0-9_]+$
1111
11331112 - `type: "text_editor_code_execution_tool_result"`
11341113
1135 - `"text_editor_code_execution_tool_result"`
1136
11371114 - `cache_control: optional BetaCacheControlEphemeral or null`
11381115
11391116 Create a cache control breakpoint at this content block.
11401117
1141 - `BetaToolSearchToolResultBlockParam object { content, tool_use_id, type, cache_control }`
1118 - `BetaToolSearchToolResultBlockParam object`
11421119
11431120 - `content: BetaToolSearchToolResultErrorParam or BetaToolSearchToolSearchResultBlockParam`
11441121
1145 - `BetaToolSearchToolResultErrorParam object { error_code, type, error_message }`
1122 - `BetaToolSearchToolResultErrorParam object`
11461123
11471124 - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"`
11481125
from line 1133
11561133
11571134 - `type: "tool_search_tool_result_error"`
11581135
1159 - `"tool_search_tool_result_error"`
1160
11611136 - `error_message: optional string or null`
11621137
1163 - `BetaToolSearchToolSearchResultBlockParam object { tool_references, type }`
1138 - `BetaToolSearchToolSearchResultBlockParam object`
11641139
11651140 - `tool_references: array of BetaToolReferenceBlockParam`
11661141
11671142 - `tool_name: string`
11681143
1144 maxLength: 256, minLength: 1, pattern: ^[a-zA-Z0-9_-]{1,256}$
1145
11691146 - `type: "tool_reference"`
11701147
11711148 - `cache_control: optional BetaCacheControlEphemeral or null`
from line 1151
11741151
11751152 - `type: "tool_search_tool_search_result"`
11761153
1177 - `"tool_search_tool_search_result"`
1178
11791154 - `tool_use_id: string`
11801155
1156 pattern: ^srvtoolu_[a-zA-Z0-9_]+$
1157
11811158 - `type: "tool_search_tool_result"`
11821159
1183 - `"tool_search_tool_result"`
1184
11851160 - `cache_control: optional BetaCacheControlEphemeral or null`
11861161
11871162 Create a cache control breakpoint at this content block.
11881163
1189 - `BetaMCPToolUseBlockParam object { id, input, name, 3 more }`
1164 - `BetaMCPToolUseBlockParam object`
11901165
11911166 - `id: string`
11921167
1168 pattern: ^[a-zA-Z0-9_-]+$
1169
11931170 - `input: map[unknown]`
11941171
11951172 - `name: string`
from line 1177
12001177
12011178 - `type: "mcp_tool_use"`
12021179
1203 - `"mcp_tool_use"`
1204
12051180 - `cache_control: optional BetaCacheControlEphemeral or null`
12061181
12071182 Create a cache control breakpoint at this content block.
12081183
1209 - `BetaRequestMCPToolResultBlockParam object { tool_use_id, type, cache_control, 2 more }`
1184 - `BetaRequestMCPToolResultBlockParam object`
12101185
12111186 - `tool_use_id: string`
12121187
1188 pattern: ^[a-zA-Z0-9_-]+$
1189
12131190 - `type: "mcp_tool_result"`
12141191
1215 - `"mcp_tool_result"`
1216
12171192 - `cache_control: optional BetaCacheControlEphemeral or null`
12181193
12191194 Create a cache control breakpoint at this content block.
from line 1201
12261201
12271202 - `text: string`
12281203
1204 minLength: 1
1205
12291206 - `type: "text"`
12301207
12311208 - `cache_control: optional BetaCacheControlEphemeral or null`
from line 1213
12361213
12371214 - `is_error: optional boolean`
12381215
1239 - `BetaContainerUploadBlockParam object { file_id, type, cache_control }`
1216 - `BetaContainerUploadBlockParam object`
12401217
12411218 A content block that represents a file to be uploaded to the container
12421219 Files uploaded via this block will be available in the container's input directory.
from line 1222
12451222
12461223 - `type: "container_upload"`
12471224
1248 - `"container_upload"`
1249
12501225 - `cache_control: optional BetaCacheControlEphemeral or null`
12511226
12521227 Create a cache control breakpoint at this content block.
12531228
1254 - `BetaCompactionBlockParam object { type, cache_control, content, encrypted_content }`
1229 - `BetaCompactionBlockParam object`
12551230
12561231 A compaction block containing summary of previous context.
12571232
from line 1238
12631238
12641239 - `type: "compaction"`
12651240
1266 - `"compaction"`
1267
12681241 - `cache_control: optional BetaCacheControlEphemeral or null`
12691242
12701243 Create a cache control breakpoint at this content block.
from line 1250
12771250
12781251 Opaque metadata from prior compaction, to be round-tripped verbatim
12791252
1280 - `BetaRequestToolAdditionBlock object { tool, type, cache_control }`
1253 - `BetaRequestToolAdditionBlock object`
12811254
12821255 Mid-conversation directive to surface a declared tool.
12831256
from line 1265
12921265 server assigns to MCP-resolved tools — use `mcp_tool_reference` or
12931266 `mcp_toolset_reference` for those.
12941267
1295 - `BetaToolChangeToolReference object { name, type }`
1268 - `BetaToolChangeToolReference object`
12961269
12971270 Reference to a single tool the caller declared directly in
12981271 `tools[]`. Does not accept the composed `{server}_{name}` form the
from line 1274
13011274
13021275 - `name: string`
13031276
1277 pattern: ^[a-zA-Z0-9_-]{1,128}$
1278
13041279 - `type: "tool_reference"`
13051280
1306 - `"tool_reference"`
1307
1308 - `BetaToolChangeMCPToolReference object { name, server_name, type }`
1281 - `BetaToolChangeMCPToolReference object`
13091282
13101283 Reference to a single MCP tool by its server and remote name — the
13111284 same `server_name`/`name` pair `mcp_tool_use` carries.
from line 1289
13161289
13171290 - `type: "mcp_tool_reference"`
13181291
1319 - `"mcp_tool_reference"`
1320
1321 - `BetaToolChangeMCPToolsetReference object { server_name, type }`
1292 - `BetaToolChangeMCPToolsetReference object`
13221293
13231294 Reference to every tool in the named MCP server's toolset.
13241295
from line 1297
13261297
13271298 - `type: "mcp_toolset_reference"`
13281299
1329 - `"mcp_toolset_reference"`
1330
13311300 - `type: "tool_addition"`
13321301
1333 - `"tool_addition"`
1334
13351302 - `cache_control: optional BetaCacheControlEphemeral or null`
13361303
13371304 Create a cache control breakpoint at this content block.
13381305
1339 - `BetaRequestToolRemovalBlock object { tool, type, cache_control }`
1306 - `BetaRequestToolRemovalBlock object`
13401307
13411308 Mid-conversation directive to withdraw a tool.
13421309
from line 1318
13511318 server assigns to MCP-resolved tools — use `mcp_tool_reference` or
13521319 `mcp_toolset_reference` for those.
13531320
1354 - `BetaToolChangeToolReference object { name, type }`
1321 - `BetaToolChangeToolReference object`
13551322
13561323 Reference to a single tool the caller declared directly in
13571324 `tools[]`. Does not accept the composed `{server}_{name}` form the
13581325 server assigns to MCP-resolved tools — use `mcp_tool_reference` or
13591326 `mcp_toolset_reference` for those.
13601327
1361 - `BetaToolChangeMCPToolReference object { name, server_name, type }`
1328 - `BetaToolChangeMCPToolReference object`
13621329
13631330 Reference to a single MCP tool by its server and remote name — the
13641331 same `server_name`/`name` pair `mcp_tool_use` carries.
13651332
1366 - `BetaToolChangeMCPToolsetReference object { server_name, type }`
1333 - `BetaToolChangeMCPToolsetReference object`
13671334
13681335 Reference to every tool in the named MCP server's toolset.
13691336
13701337 - `type: "tool_removal"`
13711338
1372 - `"tool_removal"`
1373
13741339 - `cache_control: optional BetaCacheControlEphemeral or null`
13751340
13761341 Create a cache control breakpoint at this content block.
13771342
1378 - `BetaFallbackBlockParam object { from, to, type, trigger }`
1343 - `BetaFallbackBlockParam object`
13791344
13801345 A `fallback` block echoed back from a prior response.
13811346
from line 1440
14751440
14761441 - `type: "fallback"`
14771442
1478 - `"fallback"`
1479
14801443 - `trigger: optional unknown`
14811444
14821445 The response block's `trigger`, echoed verbatim. Accepted and ignored by the server; any object or `null` is allowed.
from line 1472
15091472
15101473 List of context management edits to apply
15111474
1512 - `BetaClearToolUses20250919Edit object { type, clear_at_least, clear_tool_inputs, 3 more }`
1475 minItems: 0
1476
1477 - `BetaClearToolUses20250919Edit object`
15131478
15141479 - `type: "clear_tool_uses_20250919"`
15151480
1516 - `"clear_tool_uses_20250919"`
1517
15181481 - `clear_at_least: optional BetaInputTokensClearAtLeast or null`
15191482
15201483 Minimum number of tokens that must be cleared when triggered. Context will only be modified if at least this many tokens can be removed.
15211484
15221485 - `type: "input_tokens"`
15231486
1524 - `"input_tokens"`
1525
15261487 - `value: number`
15271488
1489 minimum: 0
1490
15281491 - `clear_tool_inputs: optional boolean or array of string or null`
15291492
15301493 Whether to clear all tool inputs (bool) or specific tool inputs to clear (list)
from line 1506
15431506
15441507 - `type: "tool_uses"`
15451508
1546 - `"tool_uses"`
1547
15481509 - `value: number`
15491510
1511 minimum: 0
1512
15501513 - `trigger: optional BetaInputTokensTrigger or BetaToolUsesTrigger`
15511514
15521515 Condition that triggers the context management strategy
15531516
1554 - `BetaInputTokensTrigger object { type, value }`
1517 - `BetaInputTokensTrigger object`
15551518
15561519 - `type: "input_tokens"`
15571520
1558 - `"input_tokens"`
1559
15601521 - `value: number`
15611522
1562 - `BetaToolUsesTrigger object { type, value }`
1523 minimum: 1
1524
1525 - `BetaToolUsesTrigger object`
15631526
15641527 - `type: "tool_uses"`
15651528
1566 - `"tool_uses"`
1567
15681529 - `value: number`
15691530
1570 - `BetaClearThinking20251015Edit object { type, keep }`
1531 minimum: 1
1532
1533 - `BetaClearThinking20251015Edit object`
15711534
15721535 - `type: "clear_thinking_20251015"`
15731536
1574 - `"clear_thinking_20251015"`
1575
15761537 - `keep: optional BetaThinkingTurns or BetaAllThinkingTurns or "all"`
15771538
15781539 Number of most recent assistant turns to keep thinking blocks for. Older turns will have their thinking blocks removed.
15791540
1580 - `BetaThinkingTurns object { type, value }`
1541 - `BetaThinkingTurns object`
15811542
15821543 - `type: "thinking_turns"`
15831544
1584 - `"thinking_turns"`
1585
15861545 - `value: number`
15871546
1588 - `BetaAllThinkingTurns object { type }`
1547 minimum: 1
1548
1549 - `BetaAllThinkingTurns object`
15891550
15901551 - `type: "all"`
15911552
1592 - `"all"`
1593
15941553 - `"all"`
15951554
1596 - `"all"`
1597
1598 - `BetaCompact20260112Edit object { type, instructions, pause_after_compaction, trigger }`
1555 - `BetaCompact20260112Edit object`
15991556
16001557 Automatically compact older context when reaching the configured trigger threshold.
16011558
16021559 - `type: "compact_20260112"`
16031560
1604 - `"compact_20260112"`
1605
16061561 - `instructions: optional string or null`
16071562
16081563 Additional instructions for summarization.
from line 1574
16191574
16201575 MCP servers to be utilized in this request
16211576
1577 maxItems: 20
1578
16221579 - `name: string`
16231580
16241581 - `type: "url"`
16251582
1626 - `"url"`
1627
16281583 - `url: string`
16291584
16301585 - `authorization_token: optional string or null`
from line 1618
16631618
16641619 - `type: "json_schema"`
16651620
1666 - `"json_schema"`
1667
16681621 - `task_budget: optional BetaTokenTaskBudget or null`
16691622
16701623 User-configurable total token budget across contexts.
from line 1626
16731626
16741627 Total token budget across all contexts in the session.
16751628
1629 minimum: 1024
1630
16761631 - `type: "tokens"`
16771632
16781633 The budget type. Currently only 'tokens' is supported.
16791634
1680 - `"tokens"`
1681
16821635 - `remaining: optional number or null`
16831636
16841637 Remaining tokens in the budget. Use this to track usage across contexts when implementing compaction client-side. Defaults to total if not provided.
16851638
1686- `output_format: optional BetaJSONOutputFormat or null`
1687
1688 Deprecated: Use `output_config.format` instead. See [structured outputs](https://platform.claude.com/docs/en/build-with-claude/structured-outputs)
1689
1690 A schema to specify Claude's output format in responses. This parameter will be removed in a future release.
1639 minimum: 0
16911640
16921641- `speed: optional "standard" or "fast" or null`
16931642
from line 1658
17091658
17101659 - `text: string`
17111660
1661 minLength: 1
1662
17121663 - `type: "text"`
17131664
17141665 - `cache_control: optional BetaCacheControlEphemeral or null`
from line 1676
17251676
17261677 See [extended thinking](https://platform.claude.com/docs/en/build-with-claude/extended-thinking) for details.
17271678
1728 - `BetaThinkingConfigEnabled object { budget_tokens, type, display }`
1679 - `BetaThinkingConfigEnabled object`
17291680
17301681 - `budget_tokens: number`
17311682
from line 1686
17351686
17361687 See [extended thinking](https://platform.claude.com/docs/en/build-with-claude/extended-thinking) for details.
17371688
1689 minimum: 1024
1690
17381691 - `type: "enabled"`
17391692
1740 - `"enabled"`
1741
17421693 - `display: optional "summarized" or "omitted" or null`
17431694
17441695 Controls how thinking content appears in the response. When set to `summarized`, thinking is returned normally. When set to `omitted`, thinking content is redacted but a signature is returned for multi-turn continuity. Defaults to `summarized`.
from line 1698
17471698
17481699 - `"omitted"`
17491700
1750 - `BetaThinkingConfigDisabled object { type }`
1701 - `BetaThinkingConfigDisabled object`
17511702
17521703 - `type: "disabled"`
17531704
1754 - `"disabled"`
1755
1756 - `BetaThinkingConfigAdaptive object { type, display }`
1705 - `BetaThinkingConfigAdaptive object`
17571706
17581707 - `type: "adaptive"`
17591708
1760 - `"adaptive"`
1761
17621709 - `display: optional "summarized" or "omitted" or null`
17631710
17641711 Controls how thinking content appears in the response. When set to `summarized`, thinking is returned normally. When set to `omitted`, thinking content is redacted but a signature is returned for multi-turn continuity. Defaults to `summarized`.
from line 1718
17711718
17721719 How the model should use the provided tools. The model can use a specific tool, any available tool, decide by itself, or not use tools at all.
17731720
1774 - `BetaToolChoiceAuto object { type, disable_parallel_tool_use }`
1721 - `BetaToolChoiceAuto object`
17751722
17761723 The model will automatically decide whether to use tools.
17771724
17781725 - `type: "auto"`
17791726
1780 - `"auto"`
1781
17821727 - `disable_parallel_tool_use: optional boolean`
17831728
17841729 Whether to disable parallel tool use.
17851730
17861731 Defaults to `false`. If set to `true`, the model will output at most one tool use.
17871732
1788 - `BetaToolChoiceAny object { type, disable_parallel_tool_use }`
1733 - `BetaToolChoiceAny object`
17891734
17901735 The model will use any available tools.
17911736
17921737 - `type: "any"`
17931738
1794 - `"any"`
1795
17961739 - `disable_parallel_tool_use: optional boolean`
17971740
17981741 Whether to disable parallel tool use.
17991742
18001743 Defaults to `false`. If set to `true`, the model will output exactly one tool use.
18011744
1802 - `BetaToolChoiceTool object { name, type, disable_parallel_tool_use }`
1745 - `BetaToolChoiceTool object`
18031746
18041747 The model will use the specified tool with `tool_choice.name`.
18051748
from line 1752
18091752
18101753 - `type: "tool"`
18111754
1812 - `"tool"`
1813
18141755 - `disable_parallel_tool_use: optional boolean`
18151756
18161757 Whether to disable parallel tool use.
18171758
18181759 Defaults to `false`. If set to `true`, the model will output exactly one tool use.
18191760
1820 - `BetaToolChoiceNone object { type }`
1761 - `BetaToolChoiceNone object`
18211762
18221763 The model will not be allowed to use tools.
18231764
18241765 - `type: "none"`
1825
1826 - `"none"`
18271766
18281767- `tools: optional array of BetaTool or BetaToolBash20241022 or BetaToolBash20250124 or 25 more`
18291768
from line 1828
18891828
18901829 See our [guide](https://platform.claude.com/docs/en/agents-and-tools/tool-use/overview) for more details.
18911830
1892 - `BetaTool object { input_schema, name, allowed_callers, 7 more }`
1893
1894 - `input_schema: object { type, properties, required }`
1831 - `BetaTool object`
1832
1833 - `input_schema: object`
18951834
18961835 [JSON schema](https://json-schema.org/draft/2020-12) for this tool's input.
18971836
from line 1838
18991838
19001839 - `type: "object"`
19011840
1902 - `"object"`
1903
19041841 - `properties: optional map[unknown] or null`
19051842
19061843 - `required: optional array of string or null`
from line 1848
19111848
19121849 This is how the tool will be called by the model and in `tool_use` blocks.
19131850
1851 maxLength: 128, minLength: 1, pattern: ^[a-zA-Z0-9_-]{1,128}$
1852
19141853 - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120" or "code_execution_20260521"`
19151854
19161855 - `"direct"`
from line 1886
19471886
19481887 - `type: optional "custom" or null`
19491888
1950 - `"custom"`
1951
1952 - `BetaToolBash20241022 object { name, type, allowed_callers, 4 more }`
1889 - `BetaToolBash20241022 object`
19531890
19541891 - `name: "bash"`
19551892
from line 1894
19571894
19581895 This is how the tool will be called by the model and in `tool_use` blocks.
19591896
1960 - `"bash"`
1961
19621897 - `type: "bash_20241022"`
19631898
1964 - `"bash_20241022"`
1965
19661899 - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120" or "code_execution_20260521"`
19671900
19681901 - `"direct"`
from line 1920
19871920
19881921 When true, guarantees schema validation on tool names and inputs
19891922
1990 - `BetaToolBash20250124 object { name, type, allowed_callers, 4 more }`
1923 - `BetaToolBash20250124 object`
19911924
19921925 - `name: "bash"`
19931926
from line 1928
19951928
19961929 This is how the tool will be called by the model and in `tool_use` blocks.
19971930
1998 - `"bash"`
1999
20001931 - `type: "bash_20250124"`
20011932
2002 - `"bash_20250124"`
2003
20041933 - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120" or "code_execution_20260521"`
20051934
20061935 - `"direct"`
from line 1954
20251954
20261955 When true, guarantees schema validation on tool names and inputs
20271956
2028 - `BetaCodeExecutionTool20250522 object { name, type, allowed_callers, 3 more }`
1957 - `BetaCodeExecutionTool20250522 object`
20291958
20301959 - `name: "code_execution"`
20311960
from line 1962
20331962
20341963 This is how the tool will be called by the model and in `tool_use` blocks.
20351964
2036 - `"code_execution"`
2037
20381965 - `type: "code_execution_20250522"`
20391966
2040 - `"code_execution_20250522"`
2041
20421967 - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120" or "code_execution_20260521"`
20431968
20441969 - `"direct"`
from line 1986
20611986
20621987 When true, guarantees schema validation on tool names and inputs
20631988
2064 - `BetaCodeExecutionTool20250825 object { name, type, allowed_callers, 3 more }`
1989 - `BetaCodeExecutionTool20250825 object`
20651990
20661991 - `name: "code_execution"`
20671992
from line 1994
20691994
20701995 This is how the tool will be called by the model and in `tool_use` blocks.
20711996
2072 - `"code_execution"`
2073
20741997 - `type: "code_execution_20250825"`
20751998
1999 - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120" or "code_execution_20260521"`
2000
2001 - `"direct"`
2002
20762003 - `"code_execution_20250825"`
20772004
2005 - `"code_execution_20260120"`
2006
2007 - `"code_execution_20260521"`
2008
2009 - `cache_control: optional BetaCacheControlEphemeral or null`
2010
2011 Create a cache control breakpoint at this content block.
2012
2013 - `defer_loading: optional boolean`
2014
2015 If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.
2016
2017 - `strict: optional boolean`
2018
2019 When true, guarantees schema validation on tool names and inputs
2020
2021 - `BetaCodeExecutionTool20260120 object`
2022
2023 Code execution tool with REPL state persistence (daemon mode + gVisor checkpoint).
2024
2025 - `name: "code_execution"`
2026
2027 Name of the tool.
2028
2029 This is how the tool will be called by the model and in `tool_use` blocks.
2030
2031 - `type: "code_execution_20260120"`
2032
20782033 - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120" or "code_execution_20260521"`
20792034
20802035 - `"direct"`
from line 2052
20972052
20982053 When true, guarantees schema validation on tool names and inputs
20992054
2100 - `BetaCodeExecutionTool20260120 object { name, type, allowed_callers, 3 more }`
2101
2102 Code execution tool with REPL state persistence (daemon mode + gVisor checkpoint).
2055 - `BetaCodeExecutionTool20260521 object`
2056
2057 Code execution tool with REPL state persistence.
21032058
21042059 - `name: "code_execution"`
21052060
from line 2062
21072062
21082063 This is how the tool will be called by the model and in `tool_use` blocks.
21092064
2110 - `"code_execution"`
2111
2112 - `type: "code_execution_20260120"`
2065 - `type: "code_execution_20260521"`
2066
2067 - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120" or "code_execution_20260521"`
2068
2069 - `"direct"`
2070
2071 - `"code_execution_20250825"`
21132072
21142073 - `"code_execution_20260120"`
21152074
2116 - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120" or "code_execution_20260521"`
2117
2118 - `"direct"`
2119
2120 - `"code_execution_20250825"`
2121
2122 - `"code_execution_20260120"`
2123
21242075 - `"code_execution_20260521"`
21252076
21262077 - `cache_control: optional BetaCacheControlEphemeral or null`
from line 2086
21352086
21362087 When true, guarantees schema validation on tool names and inputs
21372088
2138 - `BetaCodeExecutionTool20260521 object { name, type, allowed_callers, 3 more }`
2139
2140 Code execution tool with REPL state persistence.
2141
2142 - `name: "code_execution"`
2143
2144 Name of the tool.
2145
2146 This is how the tool will be called by the model and in `tool_use` blocks.
2147
2148 - `"code_execution"`
2149
2150 - `type: "code_execution_20260521"`
2151
2152 - `"code_execution_20260521"`
2153
2154 - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120" or "code_execution_20260521"`
2155
2156 - `"direct"`
2157
2158 - `"code_execution_20250825"`
2159
2160 - `"code_execution_20260120"`
2161
2162 - `"code_execution_20260521"`
2163
2164 - `cache_control: optional BetaCacheControlEphemeral or null`
2165
2166 Create a cache control breakpoint at this content block.
2167
2168 - `defer_loading: optional boolean`
2169
2170 If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.
2171
2172 - `strict: optional boolean`
2173
2174 When true, guarantees schema validation on tool names and inputs
2175
2176 - `BetaBrowserToolset20260801 object { type, allowed_callers, cache_control, configs }`
2089 - `BetaBrowserToolset20260801 object`
21772090
21782091 The browser toolset: a single `tools[]` entry (carrying no
21792092 `name`) that declares the browser tool family. The model is served
from line 2094
21812094 from its schema.
21822095
21832096 - `type: "browser_toolset_20260801"`
2184
2185 - `"browser_toolset_20260801"`
21862097
21872098 - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120" or "code_execution_20260521"`
21882099
from line 2490
25792490
25802491 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.
25812492
2582 - `BetaToolComputerUse20241022 object { display_height_px, display_width_px, name, 7 more }`
2493 - `BetaToolComputerUse20241022 object`
25832494
25842495 - `display_height_px: number`
25852496
25862497 The height of the display in pixels.
25872498
2499 minimum: 1
2500
25882501 - `display_width_px: number`
25892502
25902503 The width of the display in pixels.
25912504
2505 minimum: 1
2506
25922507 - `name: "computer"`
25932508
25942509 Name of the tool.
25952510
25962511 This is how the tool will be called by the model and in `tool_use` blocks.
25972512
2598 - `"computer"`
2599
26002513 - `type: "computer_20241022"`
26012514
2602 - `"computer_20241022"`
2603
26042515 - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120" or "code_execution_20260521"`
26052516
26062517 - `"direct"`
from line 2534
26232534
26242535 The X11 display number (e.g. 0, 1) for the display.
26252536
2537 minimum: 0
2538
26262539 - `input_examples: optional array of map[unknown]`
26272540
26282541 - `strict: optional boolean`
26292542
26302543 When true, guarantees schema validation on tool names and inputs
26312544
2632 - `BetaMemoryTool20250818 object { name, type, allowed_callers, 4 more }`
2545 - `BetaMemoryTool20250818 object`
26332546
26342547 - `name: "memory"`
26352548
from line 2550
26372550
26382551 This is how the tool will be called by the model and in `tool_use` blocks.
26392552
2640 - `"memory"`
2641
26422553 - `type: "memory_20250818"`
26432554
2644 - `"memory_20250818"`
2645
26462555 - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120" or "code_execution_20260521"`
26472556
26482557 - `"direct"`
from line 2576
26672576
26682577 When true, guarantees schema validation on tool names and inputs
26692578
2670 - `BetaToolComputerUse20250124 object { display_height_px, display_width_px, name, 7 more }`
2579 - `BetaToolComputerUse20250124 object`
26712580
26722581 - `display_height_px: number`
26732582
26742583 The height of the display in pixels.
26752584
2585 minimum: 1
2586
26762587 - `display_width_px: number`
26772588
26782589 The width of the display in pixels.
26792590
2591 minimum: 1
2592
26802593 - `name: "computer"`
26812594
26822595 Name of the tool.
26832596
26842597 This is how the tool will be called by the model and in `tool_use` blocks.
26852598
2686 - `"computer"`
2687
26882599 - `type: "computer_20250124"`
26892600
2690 - `"computer_20250124"`
2691
26922601 - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120" or "code_execution_20260521"`
26932602
26942603 - `"direct"`
from line 2620
27112620
27122621 The X11 display number (e.g. 0, 1) for the display.
27132622
2623 minimum: 0
2624
27142625 - `input_examples: optional array of map[unknown]`
27152626
27162627 - `strict: optional boolean`
27172628
27182629 When true, guarantees schema validation on tool names and inputs
27192630
2720 - `BetaToolTextEditor20241022 object { name, type, allowed_callers, 4 more }`
2631 - `BetaToolTextEditor20241022 object`
27212632
27222633 - `name: "str_replace_editor"`
27232634
from line 2636
27252636
27262637 This is how the tool will be called by the model and in `tool_use` blocks.
27272638
2728 - `"str_replace_editor"`
2729
27302639 - `type: "text_editor_20241022"`
27312640
2732 - `"text_editor_20241022"`
2733
27342641 - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120" or "code_execution_20260521"`
27352642
27362643 - `"direct"`
from line 2662
27552662
27562663 When true, guarantees schema validation on tool names and inputs
27572664
2758 - `BetaToolComputerUse20251124 object { display_height_px, display_width_px, name, 8 more }`
2665 - `BetaToolComputerUse20251124 object`
27592666
27602667 - `display_height_px: number`
27612668
27622669 The height of the display in pixels.
27632670
2671 minimum: 1
2672
27642673 - `display_width_px: number`
27652674
27662675 The width of the display in pixels.
27672676
2677 minimum: 1
2678
27682679 - `name: "computer"`
27692680
27702681 Name of the tool.
27712682
27722683 This is how the tool will be called by the model and in `tool_use` blocks.
27732684
2774 - `"computer"`
2775
27762685 - `type: "computer_20251124"`
27772686
2778 - `"computer_20251124"`
2779
27802687 - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120" or "code_execution_20260521"`
27812688
27822689 - `"direct"`
from line 2706
27992706
28002707 The X11 display number (e.g. 0, 1) for the display.
28012708
2709 minimum: 0
2710
28022711 - `enable_zoom: optional boolean`
28032712
28042713 Whether to enable an action to take a zoomed-in screenshot of the screen.
from line 2718
28092718
28102719 When true, guarantees schema validation on tool names and inputs
28112720
2812 - `BetaComputerToolset20260801 object { type, allowed_callers, cache_control, configs }`
2721 - `BetaComputerToolset20260801 object`
28132722
28142723 The computer toolset: a single `tools[]` entry (carrying no
28152724 `name`) that declares the computer tool family. The model is
from line 2731
28222731
28232732 - `type: "computer_toolset_20260801"`
28242733
2825 - `"computer_toolset_20260801"`
2826
28272734 - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120" or "code_execution_20260521"`
28282735
28292736 - `"direct"`
from line 2958
30512958
30522959 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.
30532960
3054 - `BetaToolTextEditor20250124 object { name, type, allowed_callers, 4 more }`
2961 - `BetaToolTextEditor20250124 object`
30552962
30562963 - `name: "str_replace_editor"`
30572964
from line 2966
30592966
30602967 This is how the tool will be called by the model and in `tool_use` blocks.
30612968
3062 - `"str_replace_editor"`
3063
30642969 - `type: "text_editor_20250124"`
30652970
3066 - `"text_editor_20250124"`
3067
30682971 - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120" or "code_execution_20260521"`
30692972
30702973 - `"direct"`
from line 2992
30892992
30902993 When true, guarantees schema validation on tool names and inputs
30912994
3092 - `BetaToolTextEditor20250429 object { name, type, allowed_callers, 4 more }`
2995 - `BetaToolTextEditor20250429 object`
30932996
30942997 - `name: "str_replace_based_edit_tool"`
30952998
from line 3000
30973000
30983001 This is how the tool will be called by the model and in `tool_use` blocks.
30993002
3100 - `"str_replace_based_edit_tool"`
3101
31023003 - `type: "text_editor_20250429"`
31033004
3104 - `"text_editor_20250429"`
3105
31063005 - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120" or "code_execution_20260521"`
31073006
31083007 - `"direct"`
from line 3026
31273026
31283027 When true, guarantees schema validation on tool names and inputs
31293028
3130 - `BetaToolTextEditor20250728 object { name, type, allowed_callers, 5 more }`
3029 - `BetaToolTextEditor20250728 object`
31313030
31323031 - `name: "str_replace_based_edit_tool"`
31333032
from line 3034
31353034
31363035 This is how the tool will be called by the model and in `tool_use` blocks.
31373036
3138 - `"str_replace_based_edit_tool"`
3139
31403037 - `type: "text_editor_20250728"`
31413038
3142 - `"text_editor_20250728"`
3143
31443039 - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120" or "code_execution_20260521"`
31453040
31463041 - `"direct"`
from line 3060
31653060
31663061 Maximum number of characters to display when viewing a file. If not specified, defaults to displaying the full file.
31673062
3063 minimum: 1
3064
31683065 - `strict: optional boolean`
31693066
31703067 When true, guarantees schema validation on tool names and inputs
31713068
3172 - `BetaWebSearchTool20250305 object { name, type, allowed_callers, 7 more }`
3069 - `BetaWebSearchTool20250305 object`
31733070
31743071 - `name: "web_search"`
31753072
from line 3074
31773074
31783075 This is how the tool will be called by the model and in `tool_use` blocks.
31793076
3180 - `"web_search"`
3181
31823077 - `type: "web_search_20250305"`
31833078
3184 - `"web_search_20250305"`
3185
31863079 - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120" or "code_execution_20260521"`
31873080
31883081 - `"direct"`
from line 3106
32133106
32143107 Maximum number of times the tool can be used in the API request.
32153108
3109 exclusiveMinimum: 0
3110
32163111 - `strict: optional boolean`
32173112
32183113 When true, guarantees schema validation on tool names and inputs
from line 3118
32233118
32243119 - `type: "approximate"`
32253120
3226 - `"approximate"`
3227
32283121 - `city: optional string or null`
32293122
32303123 The city of the user.
32313124
3125 maxLength: 255, minLength: 1
3126
32323127 - `country: optional string or null`
32333128
32343129 The two letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the user.
32353130
3131 maxLength: 2, minLength: 2
3132
32363133 - `region: optional string or null`
32373134
32383135 The region of the user.
32393136
3137 maxLength: 255, minLength: 1
3138
32403139 - `timezone: optional string or null`
32413140
32423141 The [IANA timezone](https://nodatime.org/TimeZones) of the user.
32433142
3244 - `BetaWebFetchTool20250910 object { name, type, allowed_callers, 8 more }`
3143 maxLength: 255, minLength: 1
3144
3145 - `BetaWebFetchTool20250910 object`
32453146
32463147 - `name: "web_fetch"`
32473148
from line 3150
32493150
32503151 This is how the tool will be called by the model and in `tool_use` blocks.
32513152
3252 - `"web_fetch"`
3253
32543153 - `type: "web_fetch_20250910"`
32553154
3256 - `"web_fetch_20250910"`
3257
32583155 - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120" or "code_execution_20260521"`
32593156
32603157 - `"direct"`
from line 3186
32893186
32903187 Maximum number of tokens used by including web page text content in the context. The limit is approximate and does not apply to binary content such as PDFs.
32913188
3189 exclusiveMinimum: 0
3190
32923191 - `max_uses: optional number or null`
32933192
32943193 Maximum number of times the tool can be used in the API request.
32953194
3195 exclusiveMinimum: 0
3196
32963197 - `strict: optional boolean`
32973198
32983199 When true, guarantees schema validation on tool names and inputs
32993200
3300 - `BetaWebSearchTool20260209 object { name, type, allowed_callers, 7 more }`
3201 - `BetaWebSearchTool20260209 object`
33013202
33023203 - `name: "web_search"`
33033204
from line 3206
33053206
33063207 This is how the tool will be called by the model and in `tool_use` blocks.
33073208
3308 - `"web_search"`
3309
33103209 - `type: "web_search_20260209"`
33113210
3312 - `"web_search_20260209"`
3313
33143211 - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120" or "code_execution_20260521"`
33153212
33163213 - `"direct"`
from line 3238
33413238
33423239 Maximum number of times the tool can be used in the API request.
33433240
3241 exclusiveMinimum: 0
3242
33443243 - `strict: optional boolean`
33453244
33463245 When true, guarantees schema validation on tool names and inputs
from line 3248
33493248
33503249 Parameters for the user's location. Used to provide more relevant search results.
33513250
3352 - `BetaWebFetchTool20260209 object { name, type, allowed_callers, 8 more }`
3251 - `BetaWebFetchTool20260209 object`
33533252
33543253 - `name: "web_fetch"`
33553254
from line 3256
33573256
33583257 This is how the tool will be called by the model and in `tool_use` blocks.
33593258
3360 - `"web_fetch"`
3361
33623259 - `type: "web_fetch_20260209"`
33633260
3364 - `"web_fetch_20260209"`
3365
33663261 - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120" or "code_execution_20260521"`
33673262
33683263 - `"direct"`
from line 3292
33973292
33983293 Maximum number of tokens used by including web page text content in the context. The limit is approximate and does not apply to binary content such as PDFs.
33993294
3295 exclusiveMinimum: 0
3296
34003297 - `max_uses: optional number or null`
34013298
34023299 Maximum number of times the tool can be used in the API request.
34033300
3301 exclusiveMinimum: 0
3302
34043303 - `strict: optional boolean`
34053304
34063305 When true, guarantees schema validation on tool names and inputs
34073306
3408 - `BetaWebFetchTool20260309 object { name, type, allowed_callers, 9 more }`
3307 - `BetaWebFetchTool20260309 object`
34093308
34103309 Web fetch tool with use_cache parameter for bypassing cached content.
34113310
from line 3314
34153314
34163315 This is how the tool will be called by the model and in `tool_use` blocks.
34173316
3418 - `"web_fetch"`
3419
34203317 - `type: "web_fetch_20260309"`
34213318
3422 - `"web_fetch_20260309"`
3423
34243319 - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120" or "code_execution_20260521"`
34253320
34263321 - `"direct"`
from line 3350
34553350
34563351 Maximum number of tokens used by including web page text content in the context. The limit is approximate and does not apply to binary content such as PDFs.
34573352
3353 exclusiveMinimum: 0
3354
34583355 - `max_uses: optional number or null`
34593356
34603357 Maximum number of times the tool can be used in the API request.
34613358
3359 exclusiveMinimum: 0
3360
34623361 - `strict: optional boolean`
34633362
34643363 When true, guarantees schema validation on tool names and inputs
from line 3366
34673366
34683367 Whether to use cached content. Set to false to bypass the cache and fetch fresh content. Only set to false when the user explicitly requests fresh content or when fetching rapidly-changing sources.
34693368
3470 - `BetaWebSearchTool20260318 object { name, type, allowed_callers, 8 more }`
3369 - `BetaWebSearchTool20260318 object`
34713370
34723371 - `name: "web_search"`
34733372
from line 3374
34753374
34763375 This is how the tool will be called by the model and in `tool_use` blocks.
34773376
3478 - `"web_search"`
3479
34803377 - `type: "web_search_20260318"`
34813378
3482 - `"web_search_20260318"`
3483
34843379 - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120" or "code_execution_20260521"`
34853380
34863381 - `"direct"`
from line 3406
35113406
35123407 Maximum number of times the tool can be used in the API request.
35133408
3409 exclusiveMinimum: 0
3410
35143411 - `response_inclusion: optional "full" or "excluded"`
35153412
35163413 How this tool's result blocks appear in the API response when the result was consumed by a completed code_execution call in the same turn. 'full' returns the complete content (default). 'excluded' drops the nested server_tool_use and result block pair entirely. Results from direct calls, or from code_execution calls that paused before completing, are always returned in full so they can be sent back on the next turn.
from line 3424
35273424
35283425 Parameters for the user's location. Used to provide more relevant search results.
35293426
3530 - `BetaWebFetchTool20260318 object { name, type, allowed_callers, 10 more }`
3427 - `BetaWebFetchTool20260318 object`
35313428
35323429 - `name: "web_fetch"`
35333430
from line 3432
35353432
35363433 This is how the tool will be called by the model and in `tool_use` blocks.
35373434
3538 - `"web_fetch"`
3539
35403435 - `type: "web_fetch_20260318"`
35413436
3542 - `"web_fetch_20260318"`
3543
35443437 - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120" or "code_execution_20260521"`
35453438
35463439 - `"direct"`
from line 3468
35753468
35763469 Maximum number of tokens used by including web page text content in the context. The limit is approximate and does not apply to binary content such as PDFs.
35773470
3471 exclusiveMinimum: 0
3472
35783473 - `max_uses: optional number or null`
35793474
35803475 Maximum number of times the tool can be used in the API request.
35813476
3477 exclusiveMinimum: 0
3478
35823479 - `response_inclusion: optional "full" or "excluded"`
35833480
35843481 How this tool's result blocks appear in the API response when the result was consumed by a completed code_execution call in the same turn. 'full' returns the complete content (default). 'excluded' drops the nested server_tool_use and result block pair entirely. Results from direct calls, or from code_execution calls that paused before completing, are always returned in full so they can be sent back on the next turn.
from line 3492
35953492
35963493 Whether to use cached content. Set to false to bypass the cache and fetch fresh content. Only set to false when the user explicitly requests fresh content or when fetching rapidly-changing sources.
35973494
3598 - `BetaAdvisorTool20260301 object { model, name, type, 7 more }`
3495 - `BetaAdvisorTool20260301 object`
35993496
36003497 - `model: Model`
36013498
from line 3506
36093506
36103507 This is how the tool will be called by the model and in `tool_use` blocks.
36113508
3612 - `"advisor"`
3613
36143509 - `type: "advisor_20260301"`
36153510
3616 - `"advisor_20260301"`
3617
36183511 - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120" or "code_execution_20260521"`
36193512
36203513 - `"direct"`
from line 3534
36413534
36423535 Bounds the advisor's total output (thinking + text) per call. When the advisor hits this cap, the returned advisor_result or advisor_redacted_result block carries stop_reason='max_tokens', and a truncation note is appended to the advice text the worker model sees (inside the encrypted blob in redacted mode). When set, the server also emits a remaining-tokens budget block in the advisor's prompt so the advisor self-shapes toward the cap. When omitted, the advisor model's default output cap applies and no budget block is emitted.
36433536
3537 minimum: 1024
3538
36443539 - `max_uses: optional number or null`
36453540
36463541 Maximum number of times the tool can be used in the API request.
36473542
3543 exclusiveMinimum: 0
3544
36483545 - `strict: optional boolean`
36493546
36503547 When true, guarantees schema validation on tool names and inputs
36513548
3652 - `BetaToolSearchToolBm25_20251119 object { name, type, allowed_callers, 3 more }`
3549 - `BetaToolSearchToolBm25_20251119 object`
36533550
36543551 - `name: "tool_search_tool_bm25"`
36553552
from line 3554
36573554
36583555 This is how the tool will be called by the model and in `tool_use` blocks.
36593556
3557 - `type: "tool_search_tool_bm25_20251119" or "tool_search_tool_bm25"`
3558
3559 - `"tool_search_tool_bm25_20251119"`
3560
36603561 - `"tool_search_tool_bm25"`
36613562
3662 - `type: "tool_search_tool_bm25_20251119" or "tool_search_tool_bm25"`
3663
3664 - `"tool_search_tool_bm25_20251119"`
3665
3666 - `"tool_search_tool_bm25"`
3667
36683563 - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120" or "code_execution_20260521"`
36693564
36703565 - `"direct"`
from line 3582
36873582
36883583 When true, guarantees schema validation on tool names and inputs
36893584
3690 - `BetaToolSearchToolRegex20251119 object { name, type, allowed_callers, 3 more }`
3585 - `BetaToolSearchToolRegex20251119 object`
36913586
36923587 - `name: "tool_search_tool_regex"`
36933588
from line 3590
36953590
36963591 This is how the tool will be called by the model and in `tool_use` blocks.
36973592
3593 - `type: "tool_search_tool_regex_20251119" or "tool_search_tool_regex"`
3594
3595 - `"tool_search_tool_regex_20251119"`
3596
36983597 - `"tool_search_tool_regex"`
36993598
3700 - `type: "tool_search_tool_regex_20251119" or "tool_search_tool_regex"`
3701
3702 - `"tool_search_tool_regex_20251119"`
3703
3704 - `"tool_search_tool_regex"`
3705
37063599 - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120" or "code_execution_20260521"`
37073600
37083601 - `"direct"`
from line 3618
37253618
37263619 When true, guarantees schema validation on tool names and inputs
37273620
3728 - `BetaMCPToolset object { mcp_server_name, type, cache_control, 2 more }`
3621 - `BetaMCPToolset object`
37293622
37303623 Configuration for a group of tools from an MCP server.
37313624
from line 3629
37363629
37373630 Name of the MCP server to configure tools for
37383631
3632 maxLength: 255, minLength: 1
3633
37393634 - `type: "mcp_toolset"`
37403635
3741 - `"mcp_toolset"`
3742
37433636 - `cache_control: optional BetaCacheControlEphemeral or null`
37443637
37453638 Create a cache control breakpoint at this content block.
from line 3653
37603653
37613654 - `enabled: optional boolean`
37623655
3763### Returns
3764
3765- `BetaMessageTokensCount object { context_management, input_tokens }`
3656- `output_format: optional BetaJSONOutputFormat or null`
3657
3658 **Deprecated**
3659
3660 Deprecated: Use `output_config.format` instead. See [structured outputs](https://platform.claude.com/docs/en/build-with-claude/structured-outputs)
3661
3662 A schema to specify Claude's output format in responses. This parameter will be removed in a future release.
3663
3664## Returns
3665
3666- `BetaMessageTokensCount object`
37663667
37673668 - `context_management: BetaCountTokensContextManagementResponse or null`
37683669
from line 3677
37763677
37773678 The total number of tokens across the provided list of messages, system prompt, and tools.
37783679
3779### Example
3780
3781```http
3680## Example
3681
3682```bash
37823683curl https://api.anthropic.com/v1/messages/count_tokens \
37833684 -H 'Content-Type: application/json' \
37843685 -H 'anthropic-version: 2023-06-01' \
from line 3719
38183719 }'
38193720```
38203721
3821#### Response
3722### Response (200)
38223723
38233724```json
38243725{
38253726
No line in this hunk matches that.