From 88b36442ad49ef51d7d3e61702f856e1b680dadf Mon Sep 17 00:00:00 2001 From: tkattkat Date: Tue, 7 Oct 2025 14:04:51 -0700 Subject: [PATCH 1/2] add goto tool to anthropic cua client --- lib/agent/AnthropicCUAClient.ts | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/lib/agent/AnthropicCUAClient.ts b/lib/agent/AnthropicCUAClient.ts index b6d655b6c..8400231ce 100644 --- a/lib/agent/AnthropicCUAClient.ts +++ b/lib/agent/AnthropicCUAClient.ts @@ -435,6 +435,20 @@ export class AnthropicCUAClient extends AgentClient { display_height_px: this.currentViewport.height, display_number: 1, }, + { + name: "goto", + description: "Navigate to a specific URL", + input_schema: { + type: "object", + properties: { + url: { + type: "string", + description: "The URL to navigate to", + }, + }, + required: ["url"], + }, + }, ], betas: ["computer-use-2025-01-24"], }; @@ -585,9 +599,16 @@ export class AnthropicCUAClient extends AgentClient { level: 2, }); } else { - // Handle custom tools + // Handle custom tools and built-in tools like goto let toolResult = "Tool executed successfully"; - if (this.tools && item.name in this.tools) { + if (item.name === "goto") { + try { + const url = item.input.url; + toolResult = `Successfully navigated to ${url}`; + } catch (error) { + toolResult = `Error with goto: ${error instanceof Error ? error.message : String(error)}`; + } + } else if (this.tools && item.name in this.tools) { try { const tool = this.tools[item.name]; @@ -890,6 +911,12 @@ export class AnthropicCUAClient extends AgentClient { ...input, }; } + } else if (name === "goto") { + return { + type: "function", + name: "goto", + arguments: { url: input.url }, + }; } else if (name === "str_replace_editor" || name === "bash") { // For editor or bash tools return { From 044763da7fad07c8087711cdf25f41f88186e568 Mon Sep 17 00:00:00 2001 From: tkattkat Date: Tue, 7 Oct 2025 15:59:26 -0700 Subject: [PATCH 2/2] changeset --- .changeset/afraid-comics-beam.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/afraid-comics-beam.md diff --git a/.changeset/afraid-comics-beam.md b/.changeset/afraid-comics-beam.md new file mode 100644 index 000000000..0fa5ea72a --- /dev/null +++ b/.changeset/afraid-comics-beam.md @@ -0,0 +1,5 @@ +--- +"@browserbasehq/stagehand": patch +--- + +Add goto tool to anthropicCuaClient