AnthropicTool.ts
AnthropicTool.ts overview
Section titled “AnthropicTool.ts overview”The AnthropicTool module defines Anthropic provider tools and the schemas
for their inputs and results. It covers Anthropic-owned tools such as Bash,
Code Execution, Computer Use, Memory, Text Editor, Web Search, Web Fetch, and
Tool Search, which can be attached to Anthropic-backed Effect AI language
model requests.
Since v4.0.0
Exports Grouped by Category
Section titled “Exports Grouped by Category”- Bash
- Code Execution
- CodeExecutionBashCommand
- CodeExecutionBashCommand (type alias)
- CodeExecutionProgrammaticToolCall
- CodeExecutionProgrammaticToolCall (type alias)
- CodeExecutionTextEditorCreate
- CodeExecutionTextEditorCreate (type alias)
- CodeExecutionTextEditorStrReplace
- CodeExecutionTextEditorStrReplace (type alias)
- CodeExecutionTextEditorView
- CodeExecutionTextEditorView (type alias)
- CodeExecution_20250522
- CodeExecution_20250825
- CodeExecution_20250825_Parameters
- CodeExecution_20250825_Parameters (type alias)
- Web Fetch
- Web Search
- computer use
- ComputerUseDoubleClickAction
- ComputerUseDoubleClickAction (type alias)
- ComputerUseHoldKeyAction
- ComputerUseHoldKeyAction (type alias)
- ComputerUseKeyAction
- ComputerUseKeyAction (type alias)
- ComputerUseLeftClickAction
- ComputerUseLeftClickAction (type alias)
- ComputerUseLeftClickDragAction
- ComputerUseLeftClickDragAction (type alias)
- ComputerUseLeftMouseDownAction
- ComputerUseLeftMouseDownAction (type alias)
- ComputerUseLeftMouseUpAction
- ComputerUseLeftMouseUpAction (type alias)
- ComputerUseMiddleClickAction
- ComputerUseMiddleClickAction (type alias)
- ComputerUseMouseMoveAction
- ComputerUseMouseMoveAction (type alias)
- ComputerUseRightClickAction
- ComputerUseRightClickAction (type alias)
- ComputerUseScreenshotAction
- ComputerUseScreenshotAction (type alias)
- ComputerUseScrollAction
- ComputerUseScrollAction (type alias)
- ComputerUseTripleClickAction
- ComputerUseTripleClickAction (type alias)
- ComputerUseWaitAction
- ComputerUseWaitAction (type alias)
- ComputerUseZoomAction
- ComputerUseZoomAction (type alias)
- ComputerUse_20241022
- ComputerUse_20250124
- ComputerUse_20251124
- Coordinate
- Coordinate (type alias)
- ModifierKey
- ModifierKey (type alias)
- Region
- Region (type alias)
- ScrollDirection
- ScrollDirection (type alias)
- TypeAction
- TypeAction (type alias)
- memory
- MemoryCreateCommand
- MemoryCreateCommand (type alias)
- MemoryDeleteCommand
- MemoryDeleteCommand (type alias)
- MemoryInsertCommand
- MemoryInsertCommand (type alias)
- MemoryRenameCommand
- MemoryRenameCommand (type alias)
- MemoryStrReplaceCommand
- MemoryStrReplaceCommand (type alias)
- MemoryViewCommand
- MemoryViewCommand (type alias)
- Memory_20250818
- ViewRange
- ViewRange (type alias)
- models
- text editor
- TextEditorCreateCommand
- TextEditorCreateCommand (type alias)
- TextEditorInsertCommand
- TextEditorInsertCommand (type alias)
- TextEditorStrReplaceCommand
- TextEditorStrReplaceCommand (type alias)
- TextEditorUndoEditCommand
- TextEditorUndoEditCommand (type alias)
- TextEditorViewCommand
- TextEditorViewCommand (type alias)
- TextEditor_20241022
- TextEditor_20250124
- TextEditor_20250429
- TextEditor_20250728
- tool search
Bash_20241022
Section titled “Bash_20241022”Defines the Anthropic Bash tool (2024-10-22 version).
When to use
Use when you want the model to execute bash commands with the 2024-10-22 Anthropic computer-use beta.
Details
Allows the model to execute bash commands in a sandboxed environment. Requires the “computer-use-2024-10-22” beta header.
See
Bash_20250124for the newer 2025-01-24 version of the bash tool
Signature
declare const Bash_20241022: <Mode extends Tool.FailureMode | undefined = undefined>(args: { readonly failureMode?: Mode | undefined}) => Tool.ProviderDefined< "anthropic.bash_20241022", "AnthropicBash", { readonly args: Schema.Void readonly parameters: Schema.Struct<{ readonly command: Schema.String readonly restart: Schema.optional<Schema.Boolean> }> readonly success: Schema.String readonly failure: Schema.Never readonly failureMode: Mode extends undefined ? "error" : Mode }, true>Since v4.0.0
Bash_20250124
Section titled “Bash_20250124”Defines the Anthropic Bash tool (2025-01-24 version).
When to use
Use when you want the model to execute bash commands with the 2025-01-24 Anthropic computer-use beta.
Details
Allows the model to execute bash commands in a sandboxed environment. Requires the “computer-use-2025-01-24” beta header.
See
Bash_20241022for the older 2024-10-22 version of the bash tool
Signature
declare const Bash_20250124: <Mode extends Tool.FailureMode | undefined = undefined>(args: { readonly failureMode?: Mode | undefined}) => Tool.ProviderDefined< "anthropic.bash_20250124", "AnthropicBash", { readonly args: Schema.Void readonly parameters: Schema.Struct<{ readonly command: Schema.String readonly restart: Schema.optional<Schema.Boolean> }> readonly success: Schema.String readonly failure: Schema.Never readonly failureMode: Mode extends undefined ? "error" : Mode }, true>Since v4.0.0
Code Execution
Section titled “Code Execution”CodeExecutionBashCommand
Section titled “CodeExecutionBashCommand”Schema for the bash_code_execution input variant of Anthropic Code Execution.
When to use
Use when validating or constructing a bash command request for
CodeExecution_20250522.
Details
The schema requires type to be "bash_code_execution" and command to
contain the bash command sent to Anthropic.
See
CodeExecution_20250522for the provider-defined tool that consumes this input variant
Signature
declare const CodeExecutionBashCommand: Schema.Struct<{ readonly type: Schema.Literal<"bash_code_execution"> readonly command: Schema.String}>Since v4.0.0
CodeExecutionBashCommand (type alias)
Section titled “CodeExecutionBashCommand (type alias)”Input payload for a bash command routed through the Anthropic code execution tool.
When to use
Use when representing a provider-executed bash command request for the 2025-05-22 code execution tool.
Details
The payload uses type: "bash_code_execution" to distinguish bash execution
from programmatic code and text editor operations, and command contains the
bash command to run.
See
CodeExecutionProgrammaticToolCallfor programmatic code execution inputCodeExecutionTextEditorViewfor viewing files through text editor code executionCodeExecutionTextEditorCreatefor creating files through text editor code executionCodeExecutionTextEditorStrReplacefor replacing text through text editor code executionCodeExecution_20250522for the provider-defined tool that consumes this payload
Signature
type CodeExecutionBashCommand = typeof CodeExecutionBashCommand.TypeSince v4.0.0
CodeExecutionProgrammaticToolCall
Section titled “CodeExecutionProgrammaticToolCall”Schema for a code execution request that asks Anthropic to run source code as a programmatic tool call.
When to use
Use when constructing or validating a programmatic tool call for the Anthropic Code Execution tool.
See
CodeExecution_20250522for the parent tool definition
Signature
declare const CodeExecutionProgrammaticToolCall: Schema.Struct<{ readonly type: Schema.Literal<"programmatic-tool-call"> readonly code: Schema.String}>Since v4.0.0
CodeExecutionProgrammaticToolCall (type alias)
Section titled “CodeExecutionProgrammaticToolCall (type alias)”Input payload for a programmatic code execution tool call, including the source code to execute.
Signature
type CodeExecutionProgrammaticToolCall = typeof CodeExecutionProgrammaticToolCall.TypeSince v4.0.0
CodeExecutionTextEditorCreate
Section titled “CodeExecutionTextEditorCreate”Schema for a text editor code execution request that creates a file at a path.
When to use
Use when validating or constructing an Anthropic text_editor_code_execution
tool call that should create a file.
Details
The request is discriminated by type: "text_editor_code_execution" and
command: "create". It requires path and accepts optional file_text; the
schema allows file_text to be omitted, null, or a string.
See
CodeExecution_20250522for the provider-defined tool that consumes this requestCodeExecutionTextEditorViewfor the matching view requestCodeExecutionTextEditorStrReplacefor the matching replace request
Signature
declare const CodeExecutionTextEditorCreate: Schema.Struct<{ readonly type: Schema.Literal<"text_editor_code_execution"> readonly command: Schema.Literal<"create"> readonly path: Schema.String readonly file_text: Schema.optional<Schema.NullOr<Schema.String>>}>Since v4.0.0
CodeExecutionTextEditorCreate (type alias)
Section titled “CodeExecutionTextEditorCreate (type alias)”Input payload for creating a file through the text editor code execution tool, optionally including initial file text.
Signature
type CodeExecutionTextEditorCreate = typeof CodeExecutionTextEditorCreate.TypeSince v4.0.0
CodeExecutionTextEditorStrReplace
Section titled “CodeExecutionTextEditorStrReplace”Schema for a code execution text editor request that replaces one exact string in a file.
When to use
Use when validating or constructing the str_replace text editor operation
for the 2025-05-22 Anthropic code execution tool.
Gotchas
The old_str must match the file contents exactly, including whitespace and
indentation, and must identify a single occurrence.
See
CodeExecutionTextEditorViewfor reading file contents before choosing the replacement textCodeExecution_20250522for the provider-defined tool that consumes this payload
Signature
declare const CodeExecutionTextEditorStrReplace: Schema.Struct<{ readonly type: Schema.Literal<"text_editor_code_execution"> readonly command: Schema.Literal<"str_replace"> readonly path: Schema.String readonly old_str: Schema.String readonly new_str: Schema.String}>Since v4.0.0
CodeExecutionTextEditorStrReplace (type alias)
Section titled “CodeExecutionTextEditorStrReplace (type alias)”Input payload for replacing text in a file through the text editor code execution tool.
Signature
type CodeExecutionTextEditorStrReplace = typeof CodeExecutionTextEditorStrReplace.TypeSince v4.0.0
CodeExecutionTextEditorView
Section titled “CodeExecutionTextEditorView”Schema for a code execution text editor request that views a file by path.
When to use
Use when you need the schema for provider-bound code-execution view requests before distinguishing them from create or replace text-editor commands.
Details
The encoded payload uses type: "text_editor_code_execution",
command: "view", and a path string.
See
CodeExecutionTextEditorCreatefor the command that creates a fileCodeExecutionTextEditorStrReplacefor the command that replaces text in a file
Signature
declare const CodeExecutionTextEditorView: Schema.Struct<{ readonly type: Schema.Literal<"text_editor_code_execution"> readonly command: Schema.Literal<"view"> readonly path: Schema.String}>Since v4.0.0
CodeExecutionTextEditorView (type alias)
Section titled “CodeExecutionTextEditorView (type alias)”Input payload for the view command of Anthropic’s text editor code execution tool.
When to use
Use when working at the Anthropic protocol boundary and the code-execution view request must be distinguished from standalone text-editor view requests.
Details
The payload is discriminated by type: "text_editor_code_execution" and
command: "view". The path field identifies the file to view.
Gotchas
This code execution view payload does not include view_range; line ranges
are part of the standalone text editor view payload, not this code execution
payload.
See
CodeExecution_20250522for the provider-defined code execution tool that includes this payloadTextEditorViewCommandfor the standalone text editor view payload
Signature
type CodeExecutionTextEditorView = typeof CodeExecutionTextEditorView.TypeSince v4.0.0
CodeExecution_20250522
Section titled “CodeExecution_20250522”Defines the Anthropic Code Execution tool (2025-05-22 version).
When to use
Use when you want the model to execute code in a sandboxed environment with the 2025-05-22 Anthropic code-execution beta.
Details
Allows the model to execute code in a sandboxed environment with support for multiple execution types including programmatic tool calls, bash execution, and text editor operations.
See
CodeExecutionProgrammaticToolCallfor the programmatic tool call schema
Signature
declare const CodeExecution_20250522: <Mode extends Tool.FailureMode | undefined = undefined>( args: void) => Tool.ProviderDefined< "anthropic.code_execution_20250522", "AnthropicCodeExecution", { readonly args: Schema.Void readonly parameters: Schema.Union< readonly [ Schema.Struct<{ readonly type: Schema.Literal<"programmatic-tool-call">; readonly code: Schema.String }>, Schema.Struct<{ readonly type: Schema.Literal<"bash_code_execution">; readonly command: Schema.String }>, Schema.Struct<{ readonly type: Schema.Literal<"text_editor_code_execution"> readonly command: Schema.Literal<"view"> readonly path: Schema.String }>, Schema.Struct<{ readonly type: Schema.Literal<"text_editor_code_execution"> readonly command: Schema.Literal<"create"> readonly path: Schema.String readonly file_text: Schema.optional<Schema.NullOr<Schema.String>> }>, Schema.Struct<{ readonly type: Schema.Literal<"text_editor_code_execution"> readonly command: Schema.Literal<"str_replace"> readonly path: Schema.String readonly old_str: Schema.String readonly new_str: Schema.String }> ] > readonly success: Schema.Struct<{ readonly content: Schema.$Array< Schema.Struct<{ readonly file_id: Schema.String; readonly type: Schema.Literal<"code_execution_output"> }> > readonly return_code: Schema.Number readonly stderr: Schema.String readonly stdout: Schema.String readonly type: Schema.Literal<"code_execution_result"> }> readonly failure: Schema.Struct<{ readonly error_code: Schema.Literals< readonly ["invalid_tool_input", "unavailable", "too_many_requests", "execution_time_exceeded"] > readonly type: Schema.Literal<"code_execution_tool_result_error"> }> readonly failureMode: Mode extends undefined ? "error" : Mode }, false>Since v4.0.0
CodeExecution_20250825
Section titled “CodeExecution_20250825”Defines the Anthropic Code Execution tool (2025-08-25 version).
When to use
Use when you want the model to execute code in a sandboxed environment with the 2025-08-25 Anthropic code-execution beta.
Details
Requires the code-execution-2025-08-25 beta header and uses
CodeExecution_20250825_Parameters as its input schema.
See
CodeExecution_20250522for the older 2025-05-22 code execution toolCodeExecution_20250825_Parametersfor the input schema consumed by this tool
Signature
declare const CodeExecution_20250825: <Mode extends Tool.FailureMode | undefined = undefined>( args: void) => Tool.ProviderDefined< "anthropic.code_execution_20250825", "AnthropicCodeExecution", { readonly args: Schema.Void readonly parameters: Schema.Struct<{ readonly code: Schema.String }> readonly success: Schema.Union< readonly [ Schema.Struct<{ readonly content: Schema.$Array< Schema.Struct<{ readonly file_id: Schema.String; readonly type: Schema.Literal<"code_execution_output"> }> > readonly return_code: Schema.Number readonly stderr: Schema.String readonly stdout: Schema.String readonly type: Schema.Literal<"code_execution_result"> }>, Schema.Struct<{ readonly content: Schema.$Array< Schema.Struct<{ readonly file_id: Schema.String readonly type: Schema.Literal<"bash_code_execution_output"> }> > readonly return_code: Schema.Number readonly stderr: Schema.String readonly stdout: Schema.String readonly type: Schema.Literal<"bash_code_execution_result"> }>, Schema.Struct<{ readonly content: Schema.String readonly file_type: Schema.Literals<readonly ["text", "image", "pdf"]> readonly num_lines: Schema.Union<readonly [Schema.Number, Schema.Null]> readonly start_line: Schema.Union<readonly [Schema.Number, Schema.Null]> readonly total_lines: Schema.Union<readonly [Schema.Number, Schema.Null]> readonly type: Schema.Literal<"text_editor_code_execution_view_result"> }>, Schema.Struct<{ readonly is_file_update: Schema.Boolean readonly type: Schema.Literal<"text_editor_code_execution_create_result"> }>, Schema.Struct<{ readonly lines: Schema.Union<readonly [Schema.$Array<Schema.String>, Schema.Null]> readonly new_lines: Schema.Union<readonly [Schema.Number, Schema.Null]> readonly new_start: Schema.Union<readonly [Schema.Number, Schema.Null]> readonly old_lines: Schema.Union<readonly [Schema.Number, Schema.Null]> readonly old_start: Schema.Union<readonly [Schema.Number, Schema.Null]> readonly type: Schema.Literal<"text_editor_code_execution_str_replace_result"> }> ] > readonly failure: Schema.Union< readonly [ Schema.Struct<{ readonly error_code: Schema.Literals< readonly ["invalid_tool_input", "unavailable", "too_many_requests", "execution_time_exceeded"] > readonly type: Schema.Literal<"code_execution_tool_result_error"> }>, Schema.Struct<{ readonly error_code: Schema.Literals< readonly [ "invalid_tool_input", "unavailable", "too_many_requests", "execution_time_exceeded", "output_file_too_large" ] > readonly type: Schema.Literal<"bash_code_execution_tool_result_error"> }>, Schema.Struct<{ readonly error_code: Schema.Literals< readonly [ "invalid_tool_input", "unavailable", "too_many_requests", "execution_time_exceeded", "file_not_found" ] > readonly error_message: Schema.Union<readonly [Schema.String, Schema.Null]> readonly type: Schema.Literal<"text_editor_code_execution_tool_result_error"> }> ] > readonly failureMode: Mode extends undefined ? "error" : Mode }, false>Since v4.0.0
CodeExecution_20250825_Parameters
Section titled “CodeExecution_20250825_Parameters”Schema for the 2025-08-25 code execution tool input, containing the code to execute.
When to use
Use when you need the schema for code-execution input at the Anthropic protocol boundary before sending source code to the 2025-08-25 tool.
See
CodeExecution_20250825for the provider-defined tool that consumes this schema
Signature
declare const CodeExecution_20250825_Parameters: Schema.Struct<{ readonly code: Schema.String }>Since v4.0.0
CodeExecution_20250825_Parameters (type alias)
Section titled “CodeExecution_20250825_Parameters (type alias)”Input payload for the 2025-08-25 Anthropic code execution tool.
When to use
Use when exposing the 2025-08-25 code-execution payload separately from the provider tool definition, such as at a transport or persistence boundary.
Details
The payload has a single code field containing the source code string to
execute.
See
CodeExecution_20250825for the provider-defined tool that consumes this payload
Signature
type CodeExecution_20250825_Parameters = typeof CodeExecution_20250825_Parameters.TypeSince v4.0.0
Web Fetch
Section titled “Web Fetch”WebFetchCitationsConfig
Section titled “WebFetchCitationsConfig”Defines citation configuration for web fetch.
When to use
Use when you need to enable or disable citations on web fetch results.
Details
The payload contains the enabled flag. citations is optional on
WebFetch_20250910_Args, and citations are disabled by default.
See
WebFetch_20250910_Argsfor the argument schema that consumes this configuration
Signature
declare const WebFetchCitationsConfig: Schema.Struct<{ readonly enabled: Schema.Boolean }>Since v4.0.0
WebFetchCitationsConfig (type alias)
Section titled “WebFetchCitationsConfig (type alias)”Configuration payload for enabling or disabling citations on web fetch results.
When to use
Use when typing parsed web-fetch citation configuration shared between request arguments and handler code.
Details
The payload contains the enabled flag. citations is optional on
WebFetch_20250910_Args, and citations are disabled by default.
See
WebFetch_20250910_Argsfor the argument schema that consumes this configuration
Signature
type WebFetchCitationsConfig = typeof WebFetchCitationsConfig.TypeSince v4.0.0
WebFetchParameters
Section titled “WebFetchParameters”Schema for Claude-supplied web fetch parameters.
When to use
Use when validating or constructing the url payload consumed by
WebFetch_20250910.
Details
The payload contains the single url parameter for Anthropic web fetch.
Gotchas
The URL must be user-provided or from prior search/fetch results. Maximum URL length is 250 characters.
See
WebFetch_20250910for the provider-defined tool that consumes this payload
Signature
declare const WebFetchParameters: Schema.Struct<{ readonly url: Schema.String }>Since v4.0.0
WebFetchParameters (type alias)
Section titled “WebFetchParameters (type alias)”Type of the parameters Claude supplies when invoking the Anthropic web fetch tool.
When to use
Use when typing Claude-supplied web-fetch tool parameters after schema validation, before enforcing URL provenance or length constraints.
Details
The payload contains the single url parameter for Anthropic web fetch.
Gotchas
The URL must be user-provided or from prior search/fetch results. Maximum URL length is 250 characters.
Signature
type WebFetchParameters = typeof WebFetchParameters.TypeSince v4.0.0
WebFetch_20250910
Section titled “WebFetch_20250910”Defines the web fetch tool for Claude models.
When to use
Use when you want Claude to retrieve the content of a specific web page or PDF.
Details
Allows Claude to retrieve full content from web pages and PDF documents. This is a server-side tool executed by Anthropic’s infrastructure. Selecting this tool adds the “web-fetch-2025-09-10” beta header.
See
WebSearch_20250305for discovering URLs before fetching specific content
Signature
declare const WebFetch_20250910: <Mode extends Tool.FailureMode | undefined = undefined>(args: { readonly maxUses?: number | undefined readonly allowedDomains?: ReadonlyArray<string> | undefined readonly blockedDomains?: ReadonlyArray<string> | undefined readonly citations?: Schema.Struct.ReadonlySide<{ readonly enabled: Schema.Boolean }, "Encoded"> | undefined readonly maxContentTokens?: number | undefined}) => Tool.ProviderDefined< "anthropic.web_fetch_20250910", "AnthropicWebFetch", { readonly args: Schema.Struct<{ readonly maxUses: Schema.optional<Schema.Number> readonly allowedDomains: Schema.optional<Schema.$Array<Schema.String>> readonly blockedDomains: Schema.optional<Schema.$Array<Schema.String>> readonly citations: Schema.optional<Schema.Struct<{ readonly enabled: Schema.Boolean }>> readonly maxContentTokens: Schema.optional<Schema.Number> }> readonly parameters: Schema.Struct<{ readonly url: Schema.String }> readonly success: Schema.Struct<{ readonly content: Schema.Struct<{ readonly citations: Schema.Union<readonly [Schema.Struct<{ readonly enabled: Schema.Boolean }>, Schema.Null]> readonly source: Schema.Union< readonly [ Schema.Struct<{ readonly data: Schema.String readonly media_type: Schema.Literal<"application/pdf"> readonly type: Schema.Literal<"base64"> }>, Schema.Struct<{ readonly data: Schema.String readonly media_type: Schema.Literal<"text/plain"> readonly type: Schema.Literal<"text"> }> ] > readonly title: Schema.Union<readonly [Schema.String, Schema.Null]> readonly type: Schema.Literal<"document"> }> readonly retrieved_at: Schema.Union<readonly [Schema.String, Schema.Null]> readonly type: Schema.Literal<"web_fetch_result"> readonly url: Schema.String }> readonly failure: Schema.Struct<{ readonly error_code: Schema.Literals< readonly [ "invalid_tool_input", "url_too_long", "url_not_allowed", "url_not_accessible", "unsupported_content_type", "too_many_requests", "max_uses_exceeded", "unavailable" ] > readonly type: Schema.Literal<"web_fetch_tool_result_error"> }> readonly failureMode: Mode extends undefined ? "error" : Mode }, false>Since v4.0.0
WebFetch_20250910_Args
Section titled “WebFetch_20250910_Args”Defines configuration arguments for the web fetch tool.
When to use
Use when you need to configure WebFetch_20250910 with usage limits, domain
filters, citations, or content token limits.
Details
The payload can set maxUses, domain filters, citations, and
maxContentTokens, which map to Anthropic web fetch request fields.
Gotchas
allowedDomains and blockedDomains are mutually exclusive.
maxContentTokens is approximate and does not apply to binary content such
as PDFs.
See
WebFetch_20250910for the provider-defined tool that consumes these argumentsWebFetchCitationsConfigfor configuring citations
Signature
declare const WebFetch_20250910_Args: Schema.Struct<{ readonly maxUses: Schema.optional<Schema.Number> readonly allowedDomains: Schema.optional<Schema.$Array<Schema.String>> readonly blockedDomains: Schema.optional<Schema.$Array<Schema.String>> readonly citations: Schema.optional<Schema.Struct<{ readonly enabled: Schema.Boolean }>> readonly maxContentTokens: Schema.optional<Schema.Number>}>Since v4.0.0
WebFetch_20250910_Args (type alias)
Section titled “WebFetch_20250910_Args (type alias)”Configuration arguments for the Anthropic web fetch tool, including usage limits, domain filters, citation settings, and token limits.
When to use
Use when typing parsed web-fetch tool configuration shared by the provider-defined tool and request-building code.
Gotchas
allowedDomains and blockedDomains are mutually exclusive.
maxContentTokens is approximate and does not apply to binary content such
as PDFs.
Signature
type WebFetch_20250910_Args = typeof WebFetch_20250910_Args.TypeSince v4.0.0
Web Search
Section titled “Web Search”WebSearchParameters
Section titled “WebSearchParameters”Schema for Claude-supplied web search tool parameters.
Details
The payload contains the generated query string and is consumed by
WebSearch_20250305.
See
WebSearch_20250305for the provider-defined tool that consumes this payload
Signature
declare const WebSearchParameters: Schema.Struct<{ readonly query: Schema.String }>Since v4.0.0
WebSearchParameters (type alias)
Section titled “WebSearchParameters (type alias)”Type of the parameters Claude supplies when invoking the Anthropic web search tool.
Details
Contains the generated search query used by WebSearch_20250305.
See
WebSearch_20250305for the provider-defined tool that consumes this payload
Signature
type WebSearchParameters = typeof WebSearchParameters.TypeSince v4.0.0
WebSearchUserLocation
Section titled “WebSearchUserLocation”Describes user location for localizing search results.
When to use
Use when you need to localize search results for location-dependent queries like weather, local businesses, or events.
Details
The schema uses type: "approximate" plus optional city, region,
country, and timezone. country is an ISO 3166-1 alpha-2 code, and
timezone is an IANA time zone identifier.
See
WebSearch_20250305_Argsfor the argument schema that consumes this location
Signature
declare const WebSearchUserLocation: Schema.Struct<{ readonly type: Schema.Literal<"approximate"> readonly city: Schema.optional<Schema.String> readonly region: Schema.optional<Schema.String> readonly country: Schema.optional<Schema.String> readonly timezone: Schema.optional<Schema.String>}>Since v4.0.0
WebSearch_20250305
Section titled “WebSearch_20250305”Defines the web search tool for Claude models.
When to use
Use when you want Claude to search the web for real-time information.
Details
Enables Claude to search the web for real-time information. This is a server-side tool executed by Anthropic’s infrastructure. Generally available (no beta header required).
See
WebFetch_20250910for retrieving known URLs after discovery
Signature
declare const WebSearch_20250305: <Mode extends Tool.FailureMode | undefined = undefined>(args: { readonly maxUses?: number | undefined readonly allowedDomains?: ReadonlyArray<string> | undefined readonly blockedDomains?: ReadonlyArray<string> | undefined readonly userLocation?: | { readonly type: "approximate" readonly region?: string | undefined readonly city?: string | undefined readonly country?: string | undefined readonly timezone?: string | undefined } | undefined}) => Tool.ProviderDefined< "anthropic.web_search_20250305", "AnthropicWebSearch", { readonly args: Schema.Struct<{ readonly maxUses: Schema.optional<Schema.Number> readonly allowedDomains: Schema.optional<Schema.$Array<Schema.String>> readonly blockedDomains: Schema.optional<Schema.$Array<Schema.String>> readonly userLocation: Schema.optional< Schema.Struct<{ readonly type: Schema.Literal<"approximate"> readonly city: Schema.optional<Schema.String> readonly region: Schema.optional<Schema.String> readonly country: Schema.optional<Schema.String> readonly timezone: Schema.optional<Schema.String> }> > }> readonly parameters: Schema.Struct<{ readonly query: Schema.String }> readonly success: Schema.$Array< Schema.Struct<{ readonly encrypted_content: Schema.String readonly page_age: Schema.Union<readonly [Schema.String, Schema.Null]> readonly title: Schema.String readonly type: Schema.Literal<"web_search_result"> readonly url: Schema.String }> > readonly failure: Schema.Struct<{ readonly error_code: Schema.Literals< readonly [ "invalid_tool_input", "unavailable", "max_uses_exceeded", "too_many_requests", "query_too_long", "request_too_large" ] > readonly type: Schema.Literal<"web_search_tool_result_error"> }> readonly failureMode: Mode extends undefined ? "error" : Mode }, false>Since v4.0.0
WebSearch_20250305_Args
Section titled “WebSearch_20250305_Args”Defines configuration arguments for the web search tool.
When to use
Use when you need to configure WebSearch_20250305 with search limits,
domain filters, or user location.
Details
The payload can set maxUses, allowedDomains, blockedDomains, and
userLocation.
Gotchas
allowedDomains and blockedDomains are mutually exclusive.
See
WebSearch_20250305for the provider-defined tool that consumes these argumentsWebSearchUserLocationfor localizing search results
Signature
declare const WebSearch_20250305_Args: Schema.Struct<{ readonly maxUses: Schema.optional<Schema.Number> readonly allowedDomains: Schema.optional<Schema.$Array<Schema.String>> readonly blockedDomains: Schema.optional<Schema.$Array<Schema.String>> readonly userLocation: Schema.optional< Schema.Struct<{ readonly type: Schema.Literal<"approximate"> readonly city: Schema.optional<Schema.String> readonly region: Schema.optional<Schema.String> readonly country: Schema.optional<Schema.String> readonly timezone: Schema.optional<Schema.String> }> >}>Since v4.0.0
WebSearch_20250305_Args (type alias)
Section titled “WebSearch_20250305_Args (type alias)”Configuration arguments for the Anthropic web search tool, including usage limits, domain filters, and optional user location.
Gotchas
allowedDomains and blockedDomains are mutually exclusive.
Signature
type WebSearch_20250305_Args = typeof WebSearch_20250305_Args.TypeSince v4.0.0
computer use
Section titled “computer use”ComputerUseDoubleClickAction
Section titled “ComputerUseDoubleClickAction”Schema for a computer-use action that performs a double click.
When to use
Use to validate or construct an Anthropic computer-use payload for double clicking at the current mouse position or at a specific screen coordinate.
Details
The encoded payload uses action: "double_click". The optional
coordinate field supplies the [x, y] pixel position; when omitted, the
action uses the current mouse position.
Gotchas
The coordinate schema only checks that the value is a two-number tuple. It does not validate that the point falls within the configured display dimensions.
See
ComputerUseLeftClickActionfor performing a single left click
Signature
declare const ComputerUseDoubleClickAction: Schema.Struct<{ readonly action: Schema.Literal<"double_click"> readonly coordinate: Schema.optional<Schema.Tuple<readonly [Schema.Number, Schema.Number]>>}>Since v4.0.0
ComputerUseDoubleClickAction (type alias)
Section titled “ComputerUseDoubleClickAction (type alias)”Computer-use action payload for performing a double click, optionally at a specific coordinate.
Signature
type ComputerUseDoubleClickAction = typeof ComputerUseDoubleClickAction.TypeSince v4.0.0
ComputerUseHoldKeyAction
Section titled “ComputerUseHoldKeyAction”Keeps a key pressed for a specified duration during computer-use execution.
When to use
Use to keep a keyboard key depressed for a fixed number of seconds in a computer-use action sequence.
Details
The schema describes objects with action: "hold_key", a text field
containing the key to hold, and a duration field containing the number of
seconds to hold it.
Gotchas
The schema only checks that duration is a number; it does not require a
positive value.
See
ComputerUseKeyActionfor pressing a key or key combination without holding itComputerUseWaitActionfor pausing between actions without holding a key
Signature
declare const ComputerUseHoldKeyAction: Schema.Struct<{ readonly action: Schema.Literal<"hold_key"> readonly text: Schema.String readonly duration: Schema.Number}>Since v4.0.0
ComputerUseHoldKeyAction (type alias)
Section titled “ComputerUseHoldKeyAction (type alias)”Computer-use action payload for holding a key for a specified duration.
When to use
Use to represent a key that should remain pressed for a measured interval.
Details
Set action to "hold_key", text to the key to hold, and duration to
the number of seconds to hold it.
See
ComputerUseKeyActionfor a single key press or key combination without a hold duration
Signature
type ComputerUseHoldKeyAction = typeof ComputerUseHoldKeyAction.TypeSince v4.0.0
ComputerUseKeyAction
Section titled “ComputerUseKeyAction”Schema for a computer-use action that presses a key or key combination, such
as "Return", "ctrl+c", or "ctrl+s".
When to use
Use when validating or constructing a computer-use action for keyboard shortcuts or non-text key presses.
See
TypeActionfor entering ordinary text stringsComputerUseHoldKeyActionfor holding a key for a duration
Signature
declare const ComputerUseKeyAction: Schema.Struct<{ readonly action: Schema.Literal<"key"> readonly text: Schema.String}>Since v4.0.0
ComputerUseKeyAction (type alias)
Section titled “ComputerUseKeyAction (type alias)”Computer-use action payload for pressing a key or key combination.
When to use
Use when typing parsed computer-use key action payloads after schema validation, where provider-specific key-name validation is handled outside TypeScript.
Details
The payload uses action: "key" and stores the key or key combination to
press in text, such as "Return", "ctrl+c", or "ctrl+s".
Gotchas
text is typed as string; the paired schema does not validate
provider-specific key names or key combinations.
Signature
type ComputerUseKeyAction = typeof ComputerUseKeyAction.TypeSince v4.0.0
ComputerUseLeftClickAction
Section titled “ComputerUseLeftClickAction”Schema for a computer-use action that performs a left click.
When to use
Use to validate or construct an Anthropic computer-use payload for clicking once at the current mouse position or at a specific screen coordinate.
Details
The encoded payload uses action: "left_click". The optional coordinate
field supplies the [x, y] pixel position; when omitted, the action uses the
current mouse position.
Gotchas
The coordinate schema only checks that the value is a two-number tuple. It does not validate that the point falls within the configured display dimensions.
See
ComputerUseDoubleClickActionfor performing a double clickComputerUseMouseMoveActionfor moving the mouse without clicking
Signature
declare const ComputerUseLeftClickAction: Schema.Struct<{ readonly action: Schema.Literal<"left_click"> readonly coordinate: Schema.optional<Schema.Tuple<readonly [Schema.Number, Schema.Number]>>}>Since v4.0.0
ComputerUseLeftClickAction (type alias)
Section titled “ComputerUseLeftClickAction (type alias)”Computer-use action payload for performing a left click, optionally at a specific coordinate.
Signature
type ComputerUseLeftClickAction = typeof ComputerUseLeftClickAction.TypeSince v4.0.0
ComputerUseLeftClickDragAction
Section titled “ComputerUseLeftClickDragAction”Schema for a computer-use action that drags with the left mouse button.
When to use
Use to validate or construct an Anthropic computer-use payload for dragging from one screen coordinate to another in a single action.
Details
The encoded payload uses action: "left_click_drag" and requires both
start_coordinate and coordinate as [x, y] pixel positions.
Gotchas
The coordinate schema only checks that each value is a two-number tuple. It does not validate that either point falls within the configured display dimensions.
See
ComputerUseLeftMouseDownActionfor starting a manual drag sequenceComputerUseLeftMouseUpActionfor ending a manual drag sequence
Signature
declare const ComputerUseLeftClickDragAction: Schema.Struct<{ readonly action: Schema.Literal<"left_click_drag"> readonly start_coordinate: Schema.Tuple<readonly [Schema.Number, Schema.Number]> readonly coordinate: Schema.Tuple<readonly [Schema.Number, Schema.Number]>}>Since v4.0.0
ComputerUseLeftClickDragAction (type alias)
Section titled “ComputerUseLeftClickDragAction (type alias)”Computer-use action payload for dragging from a start coordinate to an end coordinate.
Signature
type ComputerUseLeftClickDragAction = typeof ComputerUseLeftClickDragAction.TypeSince v4.0.0
ComputerUseLeftMouseDownAction
Section titled “ComputerUseLeftMouseDownAction”Starts a left mouse button press without releasing it.
When to use
Use when constructing a manual click or drag sequence that should press and hold the left mouse button before a later release.
Signature
declare const ComputerUseLeftMouseDownAction: Schema.Struct<{ readonly action: Schema.Literal<"left_mouse_down"> readonly coordinate: Schema.optional<Schema.Tuple<readonly [Schema.Number, Schema.Number]>>}>Since v4.0.0
ComputerUseLeftMouseDownAction (type alias)
Section titled “ComputerUseLeftMouseDownAction (type alias)”Computer-use action payload for pressing and holding the left mouse button, optionally at a specific coordinate.
Signature
type ComputerUseLeftMouseDownAction = typeof ComputerUseLeftMouseDownAction.TypeSince v4.0.0
ComputerUseLeftMouseUpAction
Section titled “ComputerUseLeftMouseUpAction”Releases the left mouse button.
When to use
Use when constructing a manual click or drag sequence that should release the left mouse button after it was previously held down.
Signature
declare const ComputerUseLeftMouseUpAction: Schema.Struct<{ readonly action: Schema.Literal<"left_mouse_up"> readonly coordinate: Schema.optional<Schema.Tuple<readonly [Schema.Number, Schema.Number]>>}>Since v4.0.0
ComputerUseLeftMouseUpAction (type alias)
Section titled “ComputerUseLeftMouseUpAction (type alias)”Computer-use action payload for releasing the left mouse button, optionally at a specific coordinate.
Signature
type ComputerUseLeftMouseUpAction = typeof ComputerUseLeftMouseUpAction.TypeSince v4.0.0
ComputerUseMiddleClickAction
Section titled “ComputerUseMiddleClickAction”Schema for a computer-use action that performs a middle click.
When to use
Use to validate or construct a middle-button click action for Anthropic computer use, optionally targeting a specific screen coordinate.
Details
The payload must use action: "middle_click". When coordinate is omitted,
the click occurs at the current mouse position.
Gotchas
This action is available in the 2025-01-24 computer-use action set and later;
it is not part of ComputerUse_20241022.
See
ComputerUse_20250124for the provider-defined tool version that first accepts this actionComputerUseLeftClickActionfor primary-button clicksComputerUseRightClickActionfor secondary-button clicks
Signature
declare const ComputerUseMiddleClickAction: Schema.Struct<{ readonly action: Schema.Literal<"middle_click"> readonly coordinate: Schema.optional<Schema.Tuple<readonly [Schema.Number, Schema.Number]>>}>Since v4.0.0
ComputerUseMiddleClickAction (type alias)
Section titled “ComputerUseMiddleClickAction (type alias)”Computer-use action payload for performing a middle click, optionally at a specific coordinate.
Signature
type ComputerUseMiddleClickAction = typeof ComputerUseMiddleClickAction.TypeSince v4.0.0
ComputerUseMouseMoveAction
Section titled “ComputerUseMouseMoveAction”Schema for a computer-use action that moves the mouse cursor to a required
[x, y] screen coordinate.
When to use
Use to validate or construct a mouse movement action for an Anthropic computer-use tool call.
Details
The encoded payload has action "mouse_move" and a required coordinate
field containing the target [x, y] pixel position.
Gotchas
The coordinate schema only checks that the value is a two-number tuple. It does not validate that the point falls within the configured display dimensions.
Signature
declare const ComputerUseMouseMoveAction: Schema.Struct<{ readonly action: Schema.Literal<"mouse_move"> readonly coordinate: Schema.Tuple<readonly [Schema.Number, Schema.Number]>}>Since v4.0.0
ComputerUseMouseMoveAction (type alias)
Section titled “ComputerUseMouseMoveAction (type alias)”Computer-use action payload for moving the mouse cursor to a specific coordinate.
Signature
type ComputerUseMouseMoveAction = typeof ComputerUseMouseMoveAction.TypeSince v4.0.0
ComputerUseRightClickAction
Section titled “ComputerUseRightClickAction”Schema for a computer-use action that performs a right click, optionally at a specific screen coordinate.
When to use
Use to validate or construct the right_click action for an Anthropic
computer-use tool call.
Details
The optional coordinate field is an [x, y] screen coordinate in pixels.
When omitted, the right click is performed at the current mouse position.
See
ComputerUse_20250124for the provider-defined computer-use tool version that introduced this actionComputerUseLeftClickActionfor the corresponding left-click actionComputerUseMiddleClickActionfor the corresponding middle-click action
Signature
declare const ComputerUseRightClickAction: Schema.Struct<{ readonly action: Schema.Literal<"right_click"> readonly coordinate: Schema.optional<Schema.Tuple<readonly [Schema.Number, Schema.Number]>>}>Since v4.0.0
ComputerUseRightClickAction (type alias)
Section titled “ComputerUseRightClickAction (type alias)”Computer-use action payload for performing a right click, optionally at a specific coordinate.
Signature
type ComputerUseRightClickAction = typeof ComputerUseRightClickAction.TypeSince v4.0.0
ComputerUseScreenshotAction
Section titled “ComputerUseScreenshotAction”Schema for a computer-use action that requests a screenshot of the current display.
When to use
Use to validate or construct a computer-use tool action that asks the handler to capture the full current display.
Details
The payload contains only action: "screenshot" and does not include
coordinates or other options.
See
ComputerUseZoomActionfor requesting a zoomed-in screenshot of a specific screen region with the 2025-11-24 computer-use tool
Signature
declare const ComputerUseScreenshotAction: Schema.Struct<{ readonly action: Schema.Literal<"screenshot"> }>Since v4.0.0
ComputerUseScreenshotAction (type alias)
Section titled “ComputerUseScreenshotAction (type alias)”Computer-use action payload for capturing the current display.
Signature
type ComputerUseScreenshotAction = typeof ComputerUseScreenshotAction.TypeSince v4.0.0
ComputerUseScrollAction
Section titled “ComputerUseScrollAction”Schema for a computer-use scroll action.
When to use
Use when validating or constructing Anthropic computer-use scroll payloads.
Details
The encoded payload uses action: "scroll", an optional coordinate,
scroll_direction, and scroll_amount.
Gotchas
coordinate only checks a two-number tuple, and scroll_amount is only
Schema.Number.
See
ComputerUse_20250124for the tool version that accepts this actionScrollDirectionfor the accepted direction literals
Signature
declare const ComputerUseScrollAction: Schema.Struct<{ readonly action: Schema.Literal<"scroll"> readonly coordinate: Schema.optional<Schema.Tuple<readonly [Schema.Number, Schema.Number]>> readonly scroll_direction: Schema.Literals<readonly ["up", "down", "left", "right"]> readonly scroll_amount: Schema.Number}>Since v4.0.0
ComputerUseScrollAction (type alias)
Section titled “ComputerUseScrollAction (type alias)”Computer-use action payload for scrolling by a specified amount in a specified direction, optionally from a coordinate.
Signature
type ComputerUseScrollAction = typeof ComputerUseScrollAction.TypeSince v4.0.0
ComputerUseTripleClickAction
Section titled “ComputerUseTripleClickAction”Schema for a computer-use triple-click action.
When to use
Use when validating or constructing Anthropic computer-use triple-click payloads at the current pointer position or an optional coordinate.
Details
The encoded payload uses action: "triple_click" and an optional
coordinate.
Gotchas
coordinate only validates as a two-number tuple and does not check display
bounds.
See
ComputerUse_20250124for the tool version that accepts this actionComputerUseDoubleClickActionfor the two-click variantComputerUseLeftClickActionfor a single left click
Signature
declare const ComputerUseTripleClickAction: Schema.Struct<{ readonly action: Schema.Literal<"triple_click"> readonly coordinate: Schema.optional<Schema.Tuple<readonly [Schema.Number, Schema.Number]>>}>Since v4.0.0
ComputerUseTripleClickAction (type alias)
Section titled “ComputerUseTripleClickAction (type alias)”Computer-use action payload for performing a triple click, optionally at a specific coordinate.
Signature
type ComputerUseTripleClickAction = typeof ComputerUseTripleClickAction.TypeSince v4.0.0
ComputerUseWaitAction
Section titled “ComputerUseWaitAction”Schema for a computer-use wait action.
When to use
Use when validating or constructing Anthropic computer-use payloads that pause between actions.
Details
The encoded payload uses action: "wait" and a required duration in
seconds.
Gotchas
duration is only Schema.Number; it is not constrained to positive or
finite values.
See
ComputerUseHoldKeyActionfor another duration-based computer-use actionComputerUse_20250124for the tool version that accepts this action
Signature
declare const ComputerUseWaitAction: Schema.Struct<{ readonly action: Schema.Literal<"wait"> readonly duration: Schema.Number}>Since v4.0.0
ComputerUseWaitAction (type alias)
Section titled “ComputerUseWaitAction (type alias)”Computer-use action payload for pausing for a specified duration.
Signature
type ComputerUseWaitAction = typeof ComputerUseWaitAction.TypeSince v4.0.0
ComputerUseZoomAction
Section titled “ComputerUseZoomAction”Zooms into a specific region of the screen at full resolution.
When to use
Use when building or validating the 2025-11-24 computer-use action for a zoom-enabled tool definition.
Details
The encoded payload uses action: "zoom" and a region tuple.
Gotchas
Requires enableZoom: true in the tool definition. region is only a
four-number tuple and does not validate corner ordering or display bounds.
See
ComputerUse_20251124for the tool version that accepts this actionComputerUseScreenshotActionfor capturing the full screen instead
Signature
declare const ComputerUseZoomAction: Schema.Struct<{ readonly action: Schema.Literal<"zoom"> readonly region: Schema.Tuple<readonly [Schema.Number, Schema.Number, Schema.Number, Schema.Number]>}>Since v4.0.0
ComputerUseZoomAction (type alias)
Section titled “ComputerUseZoomAction (type alias)”Computer-use action payload for zooming into a specific screen region.
Gotchas
The enclosing computer-use tool must be configured with enableZoom: true.
region is only a four-number tuple and does not validate corner ordering or
display bounds.
Signature
type ComputerUseZoomAction = typeof ComputerUseZoomAction.TypeSince v4.0.0
ComputerUse_20241022
Section titled “ComputerUse_20241022”Defines the deprecated computer-use tool for Claude 3.5 Sonnet v2.
Details
Requires the “computer-use-2024-10-22” beta header. Basic actions only: screenshot, left_click, type, key, mouse_move.
Signature
declare const ComputerUse_20241022: <Mode extends Tool.FailureMode | undefined = undefined>(args: { readonly displayWidthPx: number readonly displayHeightPx: number readonly displayNumber?: number | undefined readonly failureMode?: Mode | undefined}) => Tool.ProviderDefined< "anthropic.computer_use_20241022", "AnthropicComputerUse", { readonly args: Schema.Struct<{ readonly displayWidthPx: Schema.Number readonly displayHeightPx: Schema.Number readonly displayNumber: Schema.optional<Schema.Number> }> readonly parameters: Schema.Union< readonly [ Schema.Struct<{ readonly action: Schema.Literal<"key">; readonly text: Schema.String }>, Schema.Struct<{ readonly action: Schema.Literal<"left_click"> readonly coordinate: Schema.optional<Schema.Tuple<readonly [Schema.Number, Schema.Number]>> }>, Schema.Struct<{ readonly action: Schema.Literal<"mouse_move"> readonly coordinate: Schema.Tuple<readonly [Schema.Number, Schema.Number]> }>, Schema.Struct<{ readonly action: Schema.Literal<"screenshot"> }>, Schema.Struct<{ readonly action: Schema.Literal<"type">; readonly text: Schema.String }> ] > readonly success: Schema.String readonly failure: Schema.Never readonly failureMode: Mode extends undefined ? "error" : Mode }, true>Since v4.0.0
ComputerUse_20250124
Section titled “ComputerUse_20250124”Defines the computer-use tool for Claude 4 models and Claude Sonnet 3.7.
When to use
Use when you need Anthropic computer use for Claude 4 models or Claude Sonnet 3.7 with the 2025-01-24 action set.
Details
Requires the “computer-use-2025-01-24” beta header. Includes basic actions plus enhanced actions: scroll, left_click_drag, right_click, middle_click, double_click, triple_click, left_mouse_down, left_mouse_up, hold_key, wait.
See
ComputerUse_20241022for the older basic action setComputerUse_20251124for the newer zoom-capable version
Signature
declare const ComputerUse_20250124: <Mode extends Tool.FailureMode | undefined = undefined>(args: { readonly displayWidthPx: number readonly displayHeightPx: number readonly displayNumber?: number | undefined readonly failureMode?: Mode | undefined}) => Tool.ProviderDefined< "anthropic.computer_20250124", "AnthropicComputerUse", { readonly args: Schema.Struct<{ readonly displayWidthPx: Schema.Number readonly displayHeightPx: Schema.Number readonly displayNumber: Schema.optional<Schema.Number> }> readonly parameters: Schema.Union< readonly [ Schema.Struct<{ readonly action: Schema.Literal<"key">; readonly text: Schema.String }>, Schema.Struct<{ readonly action: Schema.Literal<"left_click"> readonly coordinate: Schema.optional<Schema.Tuple<readonly [Schema.Number, Schema.Number]>> }>, Schema.Struct<{ readonly action: Schema.Literal<"mouse_move"> readonly coordinate: Schema.Tuple<readonly [Schema.Number, Schema.Number]> }>, Schema.Struct<{ readonly action: Schema.Literal<"screenshot"> }>, Schema.Struct<{ readonly action: Schema.Literal<"type">; readonly text: Schema.String }>, Schema.Struct<{ readonly action: Schema.Literal<"double_click"> readonly coordinate: Schema.optional<Schema.Tuple<readonly [Schema.Number, Schema.Number]>> }>, Schema.Struct<{ readonly action: Schema.Literal<"hold_key"> readonly text: Schema.String readonly duration: Schema.Number }>, Schema.Struct<{ readonly action: Schema.Literal<"left_click_drag"> readonly start_coordinate: Schema.Tuple<readonly [Schema.Number, Schema.Number]> readonly coordinate: Schema.Tuple<readonly [Schema.Number, Schema.Number]> }>, Schema.Struct<{ readonly action: Schema.Literal<"left_mouse_down"> readonly coordinate: Schema.optional<Schema.Tuple<readonly [Schema.Number, Schema.Number]>> }>, Schema.Struct<{ readonly action: Schema.Literal<"left_mouse_up"> readonly coordinate: Schema.optional<Schema.Tuple<readonly [Schema.Number, Schema.Number]>> }>, Schema.Struct<{ readonly action: Schema.Literal<"middle_click"> readonly coordinate: Schema.optional<Schema.Tuple<readonly [Schema.Number, Schema.Number]>> }>, Schema.Struct<{ readonly action: Schema.Literal<"right_click"> readonly coordinate: Schema.optional<Schema.Tuple<readonly [Schema.Number, Schema.Number]>> }>, Schema.Struct<{ readonly action: Schema.Literal<"scroll"> readonly coordinate: Schema.optional<Schema.Tuple<readonly [Schema.Number, Schema.Number]>> readonly scroll_direction: Schema.Literals<readonly ["up", "down", "left", "right"]> readonly scroll_amount: Schema.Number }>, Schema.Struct<{ readonly action: Schema.Literal<"triple_click"> readonly coordinate: Schema.optional<Schema.Tuple<readonly [Schema.Number, Schema.Number]>> }>, Schema.Struct<{ readonly action: Schema.Literal<"wait">; readonly duration: Schema.Number }> ] > readonly success: Schema.String readonly failure: Schema.Never readonly failureMode: Mode extends undefined ? "error" : Mode }, true>Since v4.0.0
ComputerUse_20251124
Section titled “ComputerUse_20251124”Defines the computer-use tool for Claude Opus 4.5 only.
When to use
Use when you need Anthropic computer use for Claude Opus 4.5 with the 2025-11-24 action set and zoom-capable screen inspection.
Details
Requires the “computer-use-2025-11-24” beta header. Includes all actions from computer_20250124 plus the zoom action for detailed screen region inspection.
Gotchas
Zoom actions require enableZoom: true in args.
See
ComputerUse_20250124for the previous action set without zoomComputerUseZoomActionfor the zoom action payload
Signature
declare const ComputerUse_20251124: <Mode extends Tool.FailureMode | undefined = undefined>(args: { readonly displayWidthPx: number readonly displayHeightPx: number readonly displayNumber?: number | undefined readonly enableZoom?: boolean | undefined readonly failureMode?: Mode | undefined}) => Tool.ProviderDefined< "anthropic.computer_20251124", "AnthropicComputerUse", { readonly args: Schema.Struct<{ readonly enableZoom: Schema.optional<Schema.Boolean> readonly displayWidthPx: Schema.Number readonly displayHeightPx: Schema.Number readonly displayNumber: Schema.optional<Schema.Number> }> readonly parameters: Schema.Union< readonly [ Schema.Struct<{ readonly action: Schema.Literal<"key">; readonly text: Schema.String }>, Schema.Struct<{ readonly action: Schema.Literal<"left_click"> readonly coordinate: Schema.optional<Schema.Tuple<readonly [Schema.Number, Schema.Number]>> }>, Schema.Struct<{ readonly action: Schema.Literal<"mouse_move"> readonly coordinate: Schema.Tuple<readonly [Schema.Number, Schema.Number]> }>, Schema.Struct<{ readonly action: Schema.Literal<"screenshot"> }>, Schema.Struct<{ readonly action: Schema.Literal<"type">; readonly text: Schema.String }>, Schema.Struct<{ readonly action: Schema.Literal<"double_click"> readonly coordinate: Schema.optional<Schema.Tuple<readonly [Schema.Number, Schema.Number]>> }>, Schema.Struct<{ readonly action: Schema.Literal<"hold_key"> readonly text: Schema.String readonly duration: Schema.Number }>, Schema.Struct<{ readonly action: Schema.Literal<"left_click_drag"> readonly start_coordinate: Schema.Tuple<readonly [Schema.Number, Schema.Number]> readonly coordinate: Schema.Tuple<readonly [Schema.Number, Schema.Number]> }>, Schema.Struct<{ readonly action: Schema.Literal<"left_mouse_down"> readonly coordinate: Schema.optional<Schema.Tuple<readonly [Schema.Number, Schema.Number]>> }>, Schema.Struct<{ readonly action: Schema.Literal<"left_mouse_up"> readonly coordinate: Schema.optional<Schema.Tuple<readonly [Schema.Number, Schema.Number]>> }>, Schema.Struct<{ readonly action: Schema.Literal<"middle_click"> readonly coordinate: Schema.optional<Schema.Tuple<readonly [Schema.Number, Schema.Number]>> }>, Schema.Struct<{ readonly action: Schema.Literal<"right_click"> readonly coordinate: Schema.optional<Schema.Tuple<readonly [Schema.Number, Schema.Number]>> }>, Schema.Struct<{ readonly action: Schema.Literal<"scroll"> readonly coordinate: Schema.optional<Schema.Tuple<readonly [Schema.Number, Schema.Number]>> readonly scroll_direction: Schema.Literals<readonly ["up", "down", "left", "right"]> readonly scroll_amount: Schema.Number }>, Schema.Struct<{ readonly action: Schema.Literal<"triple_click"> readonly coordinate: Schema.optional<Schema.Tuple<readonly [Schema.Number, Schema.Number]>> }>, Schema.Struct<{ readonly action: Schema.Literal<"wait">; readonly duration: Schema.Number }>, Schema.Struct<{ readonly action: Schema.Literal<"zoom"> readonly region: Schema.Tuple<readonly [Schema.Number, Schema.Number, Schema.Number, Schema.Number]> }> ] > readonly success: Schema.String readonly failure: Schema.Never readonly failureMode: Mode extends undefined ? "error" : Mode }, true>Since v4.0.0
Coordinate
Section titled “Coordinate”Schema for an [x, y] screen coordinate in pixels.
When to use
Use when validating computer-use action payloads that carry a single screen position and provider-side bounds checks remain acceptable.
Details
This is a two-number tuple used by computer-use actions that accept screen positions.
Gotchas
This schema validates tuple shape only and does not check display bounds.
Signature
declare const Coordinate: Schema.Tuple<readonly [Schema.Number, Schema.Number]>Since v4.0.0
Coordinate (type alias)
Section titled “Coordinate (type alias)”An [x, y] screen coordinate in pixels.
Signature
type Coordinate = typeof Coordinate.TypeSince v4.0.0
ModifierKey
Section titled “ModifierKey”Schema for modifier key literals.
Details
Allowed values are "alt", "ctrl", "meta", and "shift".
Signature
declare const ModifierKey: Schema.Literals<readonly ["alt", "ctrl", "meta", "shift"]>Since v4.0.0
ModifierKey (type alias)
Section titled “ModifierKey (type alias)”Modifier key literals.
Details
Allowed values are "alt", "ctrl", "meta", and "shift".
Signature
type ModifierKey = typeof ModifierKey.TypeSince v4.0.0
Region
Section titled “Region”Schema for an [x1, y1, x2, y2] screen region in pixels.
When to use
Use when validating computer-use action payloads that carry a rectangular screen region and provider-side bounds checks remain acceptable.
Details
The tuple represents top-left and bottom-right corners.
Gotchas
This schema validates four numbers only and does not check coordinate ordering or display bounds.
Signature
declare const Region: Schema.Tuple<readonly [Schema.Number, Schema.Number, Schema.Number, Schema.Number]>Since v4.0.0
Region (type alias)
Section titled “Region (type alias)”An [x1, y1, x2, y2] screen region in pixels, from top-left to bottom-right.
Signature
type Region = typeof Region.TypeSince v4.0.0
ScrollDirection
Section titled “ScrollDirection”Schema for scroll direction literals: "up", "down", "left", or "right".
See
ComputerUseScrollActionfor the action payload that consumes this schema
Signature
declare const ScrollDirection: Schema.Literals<readonly ["up", "down", "left", "right"]>Since v4.0.0
ScrollDirection (type alias)
Section titled “ScrollDirection (type alias)”Direction used by computer-use scroll actions: "up", "down", "left", or "right".
Signature
type ScrollDirection = typeof ScrollDirection.TypeSince v4.0.0
TypeAction
Section titled “TypeAction”Schema for a computer-use action that enters text.
When to use
Use to validate or construct a computer-use action for entering ordinary text strings.
Details
The payload uses action: "type" and a text string containing the text to
enter.
See
ComputerUseKeyActionfor key presses and keyboard shortcuts
Signature
declare const TypeAction: Schema.Struct<{ readonly action: Schema.Literal<"type">; readonly text: Schema.String }>Since v4.0.0
TypeAction (type alias)
Section titled “TypeAction (type alias)”Computer-use action payload for typing a text string.
Details
The payload uses action: "type" and a text string containing the text to
enter.
Signature
type TypeAction = typeof TypeAction.TypeSince v4.0.0
memory
Section titled “memory”MemoryCreateCommand
Section titled “MemoryCreateCommand”Schema for the memory tool command that creates a new file at a path.
Details
The payload contains command: "create" and a path string.
Signature
declare const MemoryCreateCommand: Schema.Struct<{ readonly command: Schema.Literal<"create"> readonly path: Schema.String}>Since v4.0.0
MemoryCreateCommand (type alias)
Section titled “MemoryCreateCommand (type alias)”Memory tool command payload for creating a new file at a path.
Signature
type MemoryCreateCommand = typeof MemoryCreateCommand.TypeSince v4.0.0
MemoryDeleteCommand
Section titled “MemoryDeleteCommand”Schema for a memory command that deletes a file or directory.
Signature
declare const MemoryDeleteCommand: Schema.Struct<{ readonly command: Schema.Literal<"delete"> readonly path: Schema.String}>Since v4.0.0
MemoryDeleteCommand (type alias)
Section titled “MemoryDeleteCommand (type alias)”Memory tool command payload for deleting a file or directory at a path.
Signature
type MemoryDeleteCommand = typeof MemoryDeleteCommand.TypeSince v4.0.0
MemoryInsertCommand
Section titled “MemoryInsertCommand”Schema for the memory insert command.
When to use
Use when validating or constructing insert payloads for Memory_20250818.
Details
The payload is discriminated by command: "insert" and requires path,
insert_line, and insert_text.
See
Memory_20250818for the provider-defined tool that consumes this commandMemoryStrReplaceCommandfor replacing existing text instead
Signature
declare const MemoryInsertCommand: Schema.Struct<{ readonly command: Schema.Literal<"insert"> readonly path: Schema.String readonly insert_line: Schema.Number readonly insert_text: Schema.String}>Since v4.0.0
MemoryInsertCommand (type alias)
Section titled “MemoryInsertCommand (type alias)”Memory tool command payload for inserting text at a specific line in a file.
Signature
type MemoryInsertCommand = typeof MemoryInsertCommand.TypeSince v4.0.0
MemoryRenameCommand
Section titled “MemoryRenameCommand”Schema for the memory command that renames or moves a file or directory.
Details
The payload uses command: "rename" and requires old_path as the current
path plus new_path as the new destination path.
Signature
declare const MemoryRenameCommand: Schema.Struct<{ readonly command: Schema.Literal<"rename"> readonly old_path: Schema.String readonly new_path: Schema.String}>Since v4.0.0
MemoryRenameCommand (type alias)
Section titled “MemoryRenameCommand (type alias)”Memory tool command payload for renaming or moving a file or directory.
Signature
type MemoryRenameCommand = typeof MemoryRenameCommand.TypeSince v4.0.0
MemoryStrReplaceCommand
Section titled “MemoryStrReplaceCommand”Schema for the memory str_replace command.
When to use
Use when validating or constructing str_replace payloads for
Memory_20250818.
Details
The payload is discriminated by command: "str_replace" and requires path,
old_str, and new_str.
See
Memory_20250818for the provider-defined tool that consumes this command
Signature
declare const MemoryStrReplaceCommand: Schema.Struct<{ readonly command: Schema.Literal<"str_replace"> readonly path: Schema.String readonly old_str: Schema.String readonly new_str: Schema.String}>Since v4.0.0
MemoryStrReplaceCommand (type alias)
Section titled “MemoryStrReplaceCommand (type alias)”Memory tool command payload for replacing text in a file.
Signature
type MemoryStrReplaceCommand = typeof MemoryStrReplaceCommand.TypeSince v4.0.0
MemoryViewCommand
Section titled “MemoryViewCommand”Shows directory contents or file contents with optional line ranges.
Details
When used on a file, returns file contents optionally limited by view_range.
When used on a directory, lists contents.
Signature
declare const MemoryViewCommand: Schema.Struct<{ readonly command: Schema.Literal<"view"> readonly path: Schema.String readonly view_range: Schema.optional<Schema.Tuple<readonly [Schema.Number, Schema.Number]>>}>Since v4.0.0
MemoryViewCommand (type alias)
Section titled “MemoryViewCommand (type alias)”Memory tool command payload for viewing a file or directory, optionally with a file line range.
Signature
type MemoryViewCommand = typeof MemoryViewCommand.TypeSince v4.0.0
Memory_20250818
Section titled “Memory_20250818”Defines the memory tool for persistent file operations across conversations.
Details
Provides commands for creating, viewing, editing, renaming, and deleting files within the model’s memory space.
Signature
declare const Memory_20250818: <Mode extends Tool.FailureMode | undefined = undefined>( args: void) => Tool.ProviderDefined< "anthropic.memory_20250818", "AnthropicMemory", { readonly args: Schema.Void readonly parameters: Schema.Union< readonly [ Schema.Struct<{ readonly command: Schema.Literal<"create">; readonly path: Schema.String }>, Schema.Struct<{ readonly command: Schema.Literal<"delete">; readonly path: Schema.String }>, Schema.Struct<{ readonly command: Schema.Literal<"insert"> readonly path: Schema.String readonly insert_line: Schema.Number readonly insert_text: Schema.String }>, Schema.Struct<{ readonly command: Schema.Literal<"rename"> readonly old_path: Schema.String readonly new_path: Schema.String }>, Schema.Struct<{ readonly command: Schema.Literal<"str_replace"> readonly path: Schema.String readonly old_str: Schema.String readonly new_str: Schema.String }>, Schema.Struct<{ readonly command: Schema.Literal<"view"> readonly path: Schema.String readonly view_range: Schema.optional<Schema.Tuple<readonly [Schema.Number, Schema.Number]>> }> ] > readonly success: Schema.String readonly failure: Schema.Never readonly failureMode: Mode extends undefined ? "error" : Mode }, false>Since v4.0.0
ViewRange
Section titled “ViewRange”Defines a [start, end] line range for viewing file contents.
When to use
Use when constructing or validating view_range for memory or text editor
view commands.
Details
Lines are 1-indexed. Use -1 for end to read to the end of the file. For
example, [1, 50] views lines 1-50 and [100, -1] views from line 100 to
the end of the file.
See
MemoryViewCommandfor memory view payloads that use this rangeTextEditorViewCommandfor text editor view payloads that use this range
Signature
declare const ViewRange: Schema.Tuple<readonly [Schema.Number, Schema.Number]>Since v4.0.0
ViewRange (type alias)
Section titled “ViewRange (type alias)”A [start, end] 1-indexed line range for viewing file contents, using -1 as the end value to read through the end of the file.
When to use
Use when typing view_range for memory or text editor view commands.
Signature
type ViewRange = typeof ViewRange.TypeSince v4.0.0
models
Section titled “models”AnthropicTool (type alias)
Section titled “AnthropicTool (type alias)”Union of all Anthropic provider-defined tool definitions exported by this module.
When to use
Use when a helper, collection, or option accepts any Anthropic provider-defined tool value created by this module.
Details
The union is built from the return types of the exported constructors, including Bash, Code Execution, Computer Use, Memory, Text Editor, Tool Search, Web Fetch, and Web Search tool versions.
Signature
type AnthropicTool = | ReturnType<typeof Bash_20241022> | ReturnType<typeof Bash_20250124> | ReturnType<typeof CodeExecution_20250522> | ReturnType<typeof CodeExecution_20250825> | ReturnType<typeof ComputerUse_20241022> | ReturnType<typeof ComputerUse_20250124> | ReturnType<typeof ComputerUse_20251124> | ReturnType<typeof Memory_20250818> | ReturnType<typeof TextEditor_20241022> | ReturnType<typeof TextEditor_20250124> | ReturnType<typeof TextEditor_20250429> | ReturnType<typeof TextEditor_20250728> | ReturnType<typeof ToolSearchRegex_20251119> | ReturnType<typeof ToolSearchBM25_20251119> | ReturnType<typeof WebFetch_20250910> | ReturnType<typeof WebSearch_20250305>Since v4.0.0
text editor
Section titled “text editor”TextEditorCreateCommand
Section titled “TextEditorCreateCommand”Create a new file with specified content.
When to use
Use when validating or constructing an Anthropic text editor create
command.
Details
The payload is discriminated by command: "create" and requires both path
and file_text.
Gotchas
Fails if the file already exists. Parent directories must exist.
Signature
declare const TextEditorCreateCommand: Schema.Struct<{ readonly command: Schema.Literal<"create"> readonly path: Schema.String readonly file_text: Schema.String}>Since v4.0.0
TextEditorCreateCommand (type alias)
Section titled “TextEditorCreateCommand (type alias)”Text editor command payload for creating a new file with the specified content.
When to use
Use when typing parsed text-editor create command payloads after schema validation and before dispatching to Anthropic tool handlers.
Gotchas
The command fails if the file already exists or if parent directories are missing.
Signature
type TextEditorCreateCommand = typeof TextEditorCreateCommand.TypeSince v4.0.0
TextEditorInsertCommand
Section titled “TextEditorInsertCommand”Inserts text at a specific line number in a file.
Details
Inserts the new text after the specified line number. Use 0 to insert at
the beginning of the file; other values are 1-indexed.
Signature
declare const TextEditorInsertCommand: Schema.Struct<{ readonly command: Schema.Literal<"insert"> readonly path: Schema.String readonly insert_line: Schema.Number readonly new_str: Schema.String}>Since v4.0.0
TextEditorInsertCommand (type alias)
Section titled “TextEditorInsertCommand (type alias)”Text editor command payload for inserting text after a specific line number in a file.
Signature
type TextEditorInsertCommand = typeof TextEditorInsertCommand.TypeSince v4.0.0
TextEditorStrReplaceCommand
Section titled “TextEditorStrReplaceCommand”Replaces a specific string in a file with a new string.
When to use
Use when validating or constructing standalone Anthropic text editor
str_replace commands.
Details
The payload uses command: "str_replace", path, old_str, and new_str.
new_str may be empty to delete text.
Gotchas
The old_str must match exactly (including whitespace and indentation)
and must be unique in the file.
See
TextEditorViewCommandfor reading contents before choosingold_strCodeExecutionTextEditorStrReplacefor the code-execution variant
Signature
declare const TextEditorStrReplaceCommand: Schema.Struct<{ readonly command: Schema.Literal<"str_replace"> readonly path: Schema.String readonly old_str: Schema.String readonly new_str: Schema.String}>Since v4.0.0
TextEditorStrReplaceCommand (type alias)
Section titled “TextEditorStrReplaceCommand (type alias)”Text editor command payload for replacing one exact, unique string in a file.
When to use
Use when typing parsed text-editor replace command payloads that must carry
one exact old_str match.
Gotchas
The old_str must match exactly, including whitespace and indentation, and
must be unique in the file.
Signature
type TextEditorStrReplaceCommand = typeof TextEditorStrReplaceCommand.TypeSince v4.0.0
TextEditorUndoEditCommand
Section titled “TextEditorUndoEditCommand”Undoes the last edit made to a file.
Details
Reverts the most recent str_replace, insert, or create operation on the
file.
Gotchas
This command is available in text_editor_20241022 and
text_editor_20250124, but not in text_editor_20250429 or
text_editor_20250728.
Signature
declare const TextEditorUndoEditCommand: Schema.Struct<{ readonly command: Schema.Literal<"undo_edit"> readonly path: Schema.String}>Since v4.0.0
TextEditorUndoEditCommand (type alias)
Section titled “TextEditorUndoEditCommand (type alias)”Text editor command payload for undoing the most recent edit to a file.
Gotchas
Available for text_editor_20241022 and text_editor_20250124, but not for
text_editor_20250429 or text_editor_20250728.
Signature
type TextEditorUndoEditCommand = typeof TextEditorUndoEditCommand.TypeSince v4.0.0
TextEditorViewCommand
Section titled “TextEditorViewCommand”Reads the contents of a file or lists directory contents.
When to use
Use when validating or constructing the standalone Anthropic Text Editor
view command.
Details
When used on a file, returns the file contents, optionally limited to a line
range. When used on a directory, lists all files and subdirectories.
view_range is a 1-indexed [start, end] tuple where -1 means through
the end of the file.
See
CodeExecutionTextEditorViewfor the code-execution variant withoutview_range
Signature
declare const TextEditorViewCommand: Schema.Struct<{ readonly command: Schema.Literal<"view"> readonly path: Schema.String readonly view_range: Schema.optional<Schema.Tuple<readonly [Schema.Number, Schema.Number]>>}>Since v4.0.0
TextEditorViewCommand (type alias)
Section titled “TextEditorViewCommand (type alias)”Text editor command payload for viewing file contents or listing directory contents.
Details
view_range is a 1-indexed [start, end] tuple where -1 means through
the end of the file.
Signature
type TextEditorViewCommand = typeof TextEditorViewCommand.TypeSince v4.0.0
TextEditor_20241022
Section titled “TextEditor_20241022”Defines the deprecated text editor tool for Claude 3.5 Sonnet.
When to use
Use when you need the 2024-10-22 str_replace_editor compatibility path for
Claude 3.5 Sonnet.
Details
Requires the “computer-use-2024-10-22” beta header and supports view,
create, str_replace, insert, and undo_edit commands.
See
TextEditor_20250124for the newerstr_replace_editorversionTextEditor_20250728for the Claude 4str_replace_based_edit_toolline
Signature
declare const TextEditor_20241022: <Mode extends Tool.FailureMode | undefined = undefined>(args: { readonly failureMode?: Mode | undefined}) => Tool.ProviderDefined< "anthropic.text_editor_20241022", "AnthropicTextEditor", { readonly args: Schema.Void readonly parameters: Schema.Union< readonly [ Schema.Struct<{ readonly command: Schema.Literal<"view"> readonly path: Schema.String readonly view_range: Schema.optional<Schema.Tuple<readonly [Schema.Number, Schema.Number]>> }>, Schema.Struct<{ readonly command: Schema.Literal<"create"> readonly path: Schema.String readonly file_text: Schema.String }>, Schema.Struct<{ readonly command: Schema.Literal<"str_replace"> readonly path: Schema.String readonly old_str: Schema.String readonly new_str: Schema.String }>, Schema.Struct<{ readonly command: Schema.Literal<"insert"> readonly path: Schema.String readonly insert_line: Schema.Number readonly new_str: Schema.String }>, Schema.Struct<{ readonly command: Schema.Literal<"undo_edit">; readonly path: Schema.String }> ] > readonly success: Schema.String readonly failure: Schema.Never readonly failureMode: Mode extends undefined ? "error" : Mode }, true>Since v4.0.0
TextEditor_20250124
Section titled “TextEditor_20250124”Defines the text editor tool for deprecated Claude Sonnet 3.7.
When to use
Use when you need the 2025-01-24 Claude Sonnet 3.7 text editor tool using
str_replace_editor.
Details
Requires the “computer-use-2025-01-24” beta header, requires a handler, and
supports view, create, str_replace, insert, and undo_edit commands.
See
TextEditor_20241022for the olderstr_replace_editorversionTextEditor_20250429for the Claude 4str_replace_based_edit_toolline
Signature
declare const TextEditor_20250124: <Mode extends Tool.FailureMode | undefined = undefined>(args: { readonly failureMode?: Mode | undefined}) => Tool.ProviderDefined< "anthropic.text_editor_20250124", "AnthropicTextEditor", { readonly args: Schema.Void readonly parameters: Schema.Union< readonly [ Schema.Struct<{ readonly command: Schema.Literal<"view"> readonly path: Schema.String readonly view_range: Schema.optional<Schema.Tuple<readonly [Schema.Number, Schema.Number]>> }>, Schema.Struct<{ readonly command: Schema.Literal<"create"> readonly path: Schema.String readonly file_text: Schema.String }>, Schema.Struct<{ readonly command: Schema.Literal<"str_replace"> readonly path: Schema.String readonly old_str: Schema.String readonly new_str: Schema.String }>, Schema.Struct<{ readonly command: Schema.Literal<"insert"> readonly path: Schema.String readonly insert_line: Schema.Number readonly new_str: Schema.String }>, Schema.Struct<{ readonly command: Schema.Literal<"undo_edit">; readonly path: Schema.String }> ] > readonly success: Schema.String readonly failure: Schema.Never readonly failureMode: Mode extends undefined ? "error" : Mode }, true>Since v4.0.0
TextEditor_20250429
Section titled “TextEditor_20250429”Defines the text editor tool for Claude 4 models using Anthropic’s str_replace_based_edit_tool.
When to use
Use when you need the 2025-04-29 Claude 4 str_replace_based_edit_tool
version.
Details
Requires the “computer-use-2025-01-24” beta header.
Gotchas
This version does not support the undo_edit command.
See
TextEditor_20250124for the previousstr_replace_editorversionTextEditor_20250728for the later Claude 4 text editor version
Signature
declare const TextEditor_20250429: <Mode extends Tool.FailureMode | undefined = undefined>(args: { readonly max_characters?: number | undefined readonly failureMode?: Mode | undefined}) => Tool.ProviderDefined< "anthropic.text_editor_20250429", "AnthropicTextEditor", { readonly args: Schema.Struct<{ readonly max_characters: Schema.optional<Schema.Number> }> readonly parameters: Schema.Union< readonly [ Schema.Struct<{ readonly command: Schema.Literal<"view"> readonly path: Schema.String readonly view_range: Schema.optional<Schema.Tuple<readonly [Schema.Number, Schema.Number]>> }>, Schema.Struct<{ readonly command: Schema.Literal<"create"> readonly path: Schema.String readonly file_text: Schema.String }>, Schema.Struct<{ readonly command: Schema.Literal<"str_replace"> readonly path: Schema.String readonly old_str: Schema.String readonly new_str: Schema.String }>, Schema.Struct<{ readonly command: Schema.Literal<"insert"> readonly path: Schema.String readonly insert_line: Schema.Number readonly new_str: Schema.String }> ] > readonly success: Schema.String readonly failure: Schema.Never readonly failureMode: Mode extends undefined ? "error" : Mode }, true>Since v4.0.0
TextEditor_20250728
Section titled “TextEditor_20250728”Defines the text editor tool for Claude 4 models.
Details
Uses Anthropic’s str_replace_based_edit_tool. max_characters can limit
file-view output for this version.
Gotchas
This version does not support the undo_edit command.
Signature
declare const TextEditor_20250728: <Mode extends Tool.FailureMode | undefined = undefined>(args: { readonly max_characters?: number | undefined readonly failureMode?: Mode | undefined}) => Tool.ProviderDefined< "anthropic.text_editor_20250728", "AnthropicTextEditor", { readonly args: Schema.Struct<{ readonly max_characters: Schema.optional<Schema.Number> }> readonly parameters: Schema.Union< readonly [ Schema.Struct<{ readonly command: Schema.Literal<"view"> readonly path: Schema.String readonly view_range: Schema.optional<Schema.Tuple<readonly [Schema.Number, Schema.Number]>> }>, Schema.Struct<{ readonly command: Schema.Literal<"create"> readonly path: Schema.String readonly file_text: Schema.String }>, Schema.Struct<{ readonly command: Schema.Literal<"str_replace"> readonly path: Schema.String readonly old_str: Schema.String readonly new_str: Schema.String }>, Schema.Struct<{ readonly command: Schema.Literal<"insert"> readonly path: Schema.String readonly insert_line: Schema.Number readonly new_str: Schema.String }> ] > readonly success: Schema.String readonly failure: Schema.Never readonly failureMode: Mode extends undefined ? "error" : Mode }, true>Since v4.0.0
tool search
Section titled “tool search”ToolSearchBM25Parameters
Section titled “ToolSearchBM25Parameters”Defines input parameters for BM25/natural language tool search.
When to use
Use when validating or constructing the natural-language query payload for
ToolSearchBM25_20251119.
Details
The payload contains Claude’s natural-language query. BM25 searches tool
names, descriptions, argument names, and argument descriptions.
See
ToolSearchBM25_20251119for the provider-defined tool that consumes these parameters
Signature
declare const ToolSearchBM25Parameters: Schema.Struct<{ readonly query: Schema.String }>Since v4.0.0
ToolSearchBM25Parameters (type alias)
Section titled “ToolSearchBM25Parameters (type alias)”Type of the parameters Claude supplies when invoking BM25 natural-language Anthropic tool search.
Signature
type ToolSearchBM25Parameters = typeof ToolSearchBM25Parameters.TypeSince v4.0.0
ToolSearchBM25_20251119
Section titled “ToolSearchBM25_20251119”Defines BM25/natural language tool search for Claude models.
When to use
Use when you want Claude to find relevant tools from a natural-language query instead of a regex pattern.
Details
Claude uses natural language queries to search for tools using the BM25 algorithm. The search is performed against tool names, descriptions, argument names, and argument descriptions. Requires the “advanced-tool-use-2025-11-20” beta header.
See
ToolSearchRegex_20251119for the regex-pattern alternative
Signature
declare const ToolSearchBM25_20251119: <Mode extends Tool.FailureMode | undefined = undefined>( args: void) => Tool.ProviderDefined< "anthropic.tool_search_tool_bm25_20251119", "AnthropicToolSearchBM25", { readonly args: Schema.Void readonly parameters: Schema.Struct<{ readonly query: Schema.String }> readonly success: Schema.$Array< Schema.Struct<{ readonly cache_control: Schema.optionalKey< Schema.Union< readonly [ Schema.Union< readonly [ Schema.Struct<{ readonly ttl: Schema.optionalKey<Schema.Literals<readonly ["5m", "1h"]>> readonly type: Schema.Literal<"ephemeral"> }> ] >, Schema.Null ] > > readonly tool_name: Schema.String readonly type: Schema.Literal<"tool_reference"> }> > readonly failure: Schema.Struct<{ readonly error_code: Schema.Literals< readonly ["invalid_tool_input", "unavailable", "too_many_requests", "execution_time_exceeded"] > readonly error_message: Schema.Union<readonly [Schema.String, Schema.Null]> readonly type: Schema.Literal<"tool_search_tool_result_error"> }> readonly failureMode: Mode extends undefined ? "error" : Mode }, false>Since v4.0.0
ToolSearchRegexParameters
Section titled “ToolSearchRegexParameters”Schema for regex-based tool search input parameters.
Details
Claude constructs regex patterns using Python’s re.search() syntax.
Maximum query length: 200 characters.
Signature
declare const ToolSearchRegexParameters: Schema.Struct<{ readonly query: Schema.String }>Since v4.0.0
ToolSearchRegexParameters (type alias)
Section titled “ToolSearchRegexParameters (type alias)”Type of the parameters Claude supplies when invoking regex-based Anthropic tool search.
Details
Claude constructs regex patterns using Python’s re.search() syntax.
Maximum query length: 200 characters.
Signature
type ToolSearchRegexParameters = typeof ToolSearchRegexParameters.TypeSince v4.0.0
ToolSearchRegex_20251119
Section titled “ToolSearchRegex_20251119”Defines regex-based tool search for Claude models.
Details
Claude constructs regex patterns using Python’s re.search() syntax to
find tools. The regex is matched against tool names, descriptions,
argument names, and argument descriptions.
Requires the “advanced-tool-use-2025-11-20” beta header.
Signature
declare const ToolSearchRegex_20251119: <Mode extends Tool.FailureMode | undefined = undefined>( args: void) => Tool.ProviderDefined< "anthropic.tool_search_tool_regex_20251119", "AnthropicToolSearchRegex", { readonly args: Schema.Void readonly parameters: Schema.Struct<{ readonly query: Schema.String }> readonly success: Schema.$Array< Schema.Struct<{ readonly cache_control: Schema.optionalKey< Schema.Union< readonly [ Schema.Union< readonly [ Schema.Struct<{ readonly ttl: Schema.optionalKey<Schema.Literals<readonly ["5m", "1h"]>> readonly type: Schema.Literal<"ephemeral"> }> ] >, Schema.Null ] > > readonly tool_name: Schema.String readonly type: Schema.Literal<"tool_reference"> }> > readonly failure: Schema.Struct<{ readonly error_code: Schema.Literals< readonly ["invalid_tool_input", "unavailable", "too_many_requests", "execution_time_exceeded"] > readonly error_message: Schema.Union<readonly [Schema.String, Schema.Null]> readonly type: Schema.Literal<"tool_search_tool_result_error"> }> readonly failureMode: Mode extends undefined ? "error" : Mode }, false>Since v4.0.0