Skip to main content Link Search Menu Expand Document (external link)

AnthropicTool.ts overview

Since v1.0.0


Exports Grouped by Category


Models

Coordinate

Signature

declare const Coordinate: Schema.Tuple2<typeof Schema.Number, typeof Schema.Number>

Source

Since v1.0.0

Schemas

ProviderDefinedTools

Signature

declare const ProviderDefinedTools: Schema.Union<
  [
    typeof Generated.BetaBashTool20241022,
    typeof Generated.BetaBashTool20250124,
    typeof Generated.BetaCodeExecutionTool20250522,
    typeof Generated.BetaComputerUseTool20241022,
    typeof Generated.BetaComputerUseTool20250124,
    typeof Generated.BetaTextEditor20241022,
    typeof Generated.BetaTextEditor20250124,
    typeof Generated.BetaTextEditor20250429,
    typeof Generated.BetaTextEditor20250728,
    typeof Generated.BetaWebSearchTool20250305
  ]
>

Source

Since v1.0.0

ProviderDefinedTools (type alias)

Signature

type ProviderDefinedTools = typeof ProviderDefinedTools.Type

Source

Since v1.0.0

Tool Calling

getProviderDefinedToolName

A helper method which takes in the name of a tool as returned in the response from a large language model provider, and returns either the provider-defined name for of the tool as found in the corresponding Toolkit, or undefined if the tool name is not a provider-defined tool.

For example, if the large language model provider returns the tool name "web_search" in a response, calling this method would return "AnthropicWebSearch".

This method is primarily exposed for use by other Effect provider integrations which can utilize Anthropic tools (i.e. Amazon Bedrock).

Signature

declare const getProviderDefinedToolName: (name: string) => string | undefined

Source

Since v1.0.0

Tools

Bash_20241022

Signature

declare const Bash_20241022: (args: {}) => Tool.ProviderDefined<
  "AnthropicBash",
  {
    readonly args: Schema.Struct<{}>
    readonly parameters: Schema.Struct<{
      command: typeof Schema.NonEmptyString
      restart: Schema.optional<typeof Schema.Boolean>
    }>
    readonly success: typeof Schema.String
    readonly failure: typeof Schema.Never
  },
  true
>

Source

Since v1.0.0

Bash_20250124

Signature

declare const Bash_20250124: (args: {}) => Tool.ProviderDefined<
  "AnthropicBash",
  {
    readonly args: Schema.Struct<{}>
    readonly parameters: Schema.Struct<{
      command: typeof Schema.NonEmptyString
      restart: Schema.optional<typeof Schema.Boolean>
    }>
    readonly success: typeof Schema.String
    readonly failure: typeof Schema.Never
  },
  true
>

Source

Since v1.0.0

CodeExecution_20250522

Signature

declare const CodeExecution_20250522: (args: {
  readonly cache_control?:
    | { readonly type: "ephemeral"; readonly ttl?: "5m" | "1h" | null | undefined }
    | null
    | undefined
}) => Tool.ProviderDefined<
  "AnthropicCodeExecution",
  {
    readonly args: Schema.Struct<{
      readonly cache_control: Schema.optionalWith<typeof Generated.BetaCacheControlEphemeral, { nullable: true }>
    }>
    readonly parameters: Schema.Struct<{}>
    readonly success: typeof Generated.BetaResponseCodeExecutionResultBlock
    readonly failure: typeof Generated.BetaResponseCodeExecutionToolResultError
  },
  false
>

Source

Since v1.0.0

CodeExecution_20250825

Signature

declare const CodeExecution_20250825: (args: {
  readonly cache_control?:
    | { readonly type: "ephemeral"; readonly ttl?: "5m" | "1h" | null | undefined }
    | null
    | undefined
}) => Tool.ProviderDefined<
  "AnthropicCodeExecution",
  {
    readonly args: Schema.Struct<{
      readonly cache_control: Schema.optionalWith<typeof Generated.BetaCacheControlEphemeral, { nullable: true }>
    }>
    readonly parameters: Schema.Struct<{}>
    readonly success: Schema.Union<
      [
        typeof Generated.BetaResponseBashCodeExecutionResultBlock,
        typeof Generated.BetaResponseTextEditorCodeExecutionViewResultBlock,
        typeof Generated.BetaResponseTextEditorCodeExecutionCreateResultBlock,
        typeof Generated.BetaResponseTextEditorCodeExecutionStrReplaceResultBlock
      ]
    >
    readonly failure: Schema.Union<
      [
        typeof Generated.BetaResponseCodeExecutionToolResultError,
        typeof Generated.BetaResponseTextEditorCodeExecutionToolResultError
      ]
    >
  },
  false
>

Source

Since v1.0.0

ComputerUse_20241022

Allow Claude to interact with computer environments through the computer use tool, which provides screenshot capabilities and mouse/keyboard control for autonomous desktop interaction.

Signature

declare const ComputerUse_20241022: (args: {
  readonly display_height_px: number
  readonly display_width_px: number
  readonly cache_control?:
    | { readonly type: "ephemeral"; readonly ttl?: "5m" | "1h" | null | undefined }
    | null
    | undefined
  readonly display_number?: number | null | undefined
}) => Tool.ProviderDefined<
  "AnthropicComputerUse",
  {
    readonly args: Schema.Struct<{
      readonly cache_control: Schema.optionalWith<typeof Generated.BetaCacheControlEphemeral, { nullable: true }>
      readonly display_height_px: Schema.filter<typeof Schema.Int>
      readonly display_number: Schema.optionalWith<Schema.filter<typeof Schema.Int>, { nullable: true }>
      readonly display_width_px: Schema.filter<typeof Schema.Int>
    }>
    readonly parameters: Schema.Struct<{
      action: Schema.Literal<["screenshot", "left_click", "type", "key", "mouse_move"]>
      coordinate: Schema.optional<Schema.Tuple2<typeof Schema.Number, typeof Schema.Number>>
      text: Schema.optional<typeof Schema.String>
    }>
    readonly success: typeof Schema.String
    readonly failure: typeof Schema.Never
  },
  true
>

Source

Since v1.0.0

ComputerUse_20250124

Allow Claude to interact with computer environments through the computer use tool, which provides screenshot capabilities and mouse/keyboard control for autonomous desktop interaction.

Signature

declare const ComputerUse_20250124: (args: {
  readonly display_height_px: number
  readonly display_width_px: number
  readonly cache_control?:
    | { readonly type: "ephemeral"; readonly ttl?: "5m" | "1h" | null | undefined }
    | null
    | undefined
  readonly display_number?: number | null | undefined
}) => Tool.ProviderDefined<
  "AnthropicComputerUse",
  {
    readonly args: Schema.Struct<{
      readonly cache_control: Schema.optionalWith<typeof Generated.BetaCacheControlEphemeral, { nullable: true }>
      readonly display_height_px: Schema.filter<typeof Schema.Int>
      readonly display_number: Schema.optionalWith<Schema.filter<typeof Schema.Int>, { nullable: true }>
      readonly display_width_px: Schema.filter<typeof Schema.Int>
    }>
    readonly parameters: Schema.Struct<{
      action: Schema.Literal<
        [
          "screenshot",
          "left_click",
          "type",
          "key",
          "mouse_move",
          "scroll",
          "left_click_drag",
          "middle_click",
          "right_click",
          "double_click",
          "triple_click",
          "left_mouse_down",
          "left_mouse_up",
          "hold_key",
          "wait"
        ]
      >
      coordinate: Schema.optional<Schema.Tuple2<typeof Schema.Number, typeof Schema.Number>>
      start_coordinate: Schema.optional<Schema.Tuple2<typeof Schema.Number, typeof Schema.Number>>
      text: Schema.optional<typeof Schema.String>
      scroll_direction: Schema.optional<Schema.Literal<["up", "down", "left", "right"]>>
      scroll_amount: Schema.optional<typeof Schema.Number>
      duration: Schema.optional<typeof Schema.Number>
    }>
    readonly success: typeof Schema.String
    readonly failure: typeof Schema.Never
  },
  true
>

Source

Since v1.0.0

TextEditor_20241022

Allow Claude to directly interact with your files, providing hands-on assistance rather than just suggesting changes.

Signature

declare const TextEditor_20241022: (args: {}) => Tool.ProviderDefined<
  "AnthropicTextEditor",
  {
    readonly args: Schema.Struct<{}>
    readonly parameters: Schema.Struct<{
      command: Schema.Literal<["view", "create", "str_replace", "insert", "undo_edit"]>
      path: typeof Schema.String
      file_text: Schema.optional<typeof Schema.String>
      insert_line: Schema.optional<typeof Schema.Number>
      new_str: Schema.optional<typeof Schema.String>
      old_str: Schema.optional<typeof Schema.String>
      view_range: Schema.optional<Schema.Array$<typeof Schema.Number>>
    }>
    readonly success: typeof Schema.Void
    readonly failure: typeof Schema.Never
  },
  true
>

Source

Since v1.0.0

TextEditor_20250124

Allow Claude to directly interact with your files, providing hands-on assistance rather than just suggesting changes.

Signature

declare const TextEditor_20250124: (args: {}) => Tool.ProviderDefined<
  "AnthropicTextEditor",
  {
    readonly args: Schema.Struct<{}>
    readonly parameters: Schema.Struct<{
      command: Schema.Literal<["view", "create", "str_replace", "insert", "undo_edit"]>
      path: typeof Schema.String
      file_text: Schema.optional<typeof Schema.String>
      insert_line: Schema.optional<typeof Schema.Number>
      new_str: Schema.optional<typeof Schema.String>
      old_str: Schema.optional<typeof Schema.String>
      view_range: Schema.optional<Schema.Array$<typeof Schema.Number>>
    }>
    readonly success: typeof Schema.Void
    readonly failure: typeof Schema.Never
  },
  true
>

Source

Since v1.0.0

TextEditor_20250429

Allow Claude to directly interact with your files, providing hands-on assistance rather than just suggesting changes.

Signature

declare const TextEditor_20250429: (args: {}) => Tool.ProviderDefined<
  "AnthropicTextEditor",
  {
    readonly args: Schema.Struct<{}>
    readonly parameters: Schema.Struct<{
      command: Schema.Literal<["view", "create", "str_replace", "insert"]>
      path: typeof Schema.String
      file_text: Schema.optional<typeof Schema.String>
      insert_line: Schema.optional<typeof Schema.Number>
      new_str: Schema.optional<typeof Schema.String>
      old_str: Schema.optional<typeof Schema.String>
      view_range: Schema.optional<Schema.Array$<typeof Schema.Number>>
    }>
    readonly success: typeof Schema.Void
    readonly failure: typeof Schema.Never
  },
  true
>

Source

Since v1.0.0

TextEditor_20250728

Allow Claude to directly interact with your files, providing hands-on assistance rather than just suggesting changes.

Signature

declare const TextEditor_20250728: (args: {}) => Tool.ProviderDefined<
  "AnthropicTextEditor",
  {
    readonly args: Schema.Struct<{}>
    readonly parameters: Schema.Struct<{
      command: Schema.Literal<["view", "create", "str_replace", "insert"]>
      path: typeof Schema.String
      file_text: Schema.optional<typeof Schema.String>
      insert_line: Schema.optional<typeof Schema.Number>
      new_str: Schema.optional<typeof Schema.String>
      old_str: Schema.optional<typeof Schema.String>
      view_range: Schema.optional<Schema.Array$<typeof Schema.Number>>
    }>
    readonly success: typeof Schema.Void
    readonly failure: typeof Schema.Never
  },
  true
>

Source

Since v1.0.0

WebSearch_20250305

Signature

declare const WebSearch_20250305: (args: {
  readonly cache_control?:
    | { readonly type: "ephemeral"; readonly ttl?: "5m" | "1h" | null | undefined }
    | null
    | undefined
  readonly allowed_domains?: ReadonlyArray<string> | null | undefined
  readonly blocked_domains?: ReadonlyArray<string> | null | undefined
  readonly max_uses?: number | null | undefined
  readonly user_location?:
    | {
        readonly type: "approximate"
        readonly city?: string | null | undefined
        readonly country?: string | null | undefined
        readonly region?: string | null | undefined
        readonly timezone?: string | null | undefined
      }
    | null
    | undefined
}) => Tool.ProviderDefined<
  "AnthropicWebSearch",
  {
    readonly args: Schema.Struct<{
      readonly cache_control: Schema.optionalWith<typeof Generated.CacheControlEphemeral, { nullable: true }>
      readonly allowed_domains: Schema.optionalWith<Schema.Array$<typeof Schema.String>, { nullable: true }>
      readonly blocked_domains: Schema.optionalWith<Schema.Array$<typeof Schema.String>, { nullable: true }>
      readonly max_uses: Schema.optionalWith<Schema.filter<typeof Schema.Int>, { nullable: true }>
      readonly user_location: Schema.optionalWith<typeof Generated.UserLocation, { nullable: true }>
    }>
    readonly parameters: Schema.Struct<{}>
    readonly success: Schema.Array$<typeof Generated.RequestWebSearchResultBlock>
    readonly failure: typeof Generated.ResponseWebSearchToolResultError
  },
  false
>

Source

Since v1.0.0