Skip to content
This repository was archived by the owner on Aug 6, 2026. It is now read-only.

Commit 247f275

Browse files
authored
Convert WebFetch tool results to ACP format (#1022)
1 parent 7d0739b commit 247f275

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

‎packages/agent/src/adapters/claude/conversion/tool-use-to-acp.ts‎

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -554,6 +554,31 @@ export function toolUpdateFromToolResult(
554554
}
555555
return { title: "Question answered" };
556556
}
557+
case "WebFetch": {
558+
const input = toolUse?.input as Record<string, unknown> | undefined;
559+
const url = input?.url ? String(input.url) : "";
560+
const prompt = input?.prompt ? String(input.prompt) : undefined;
561+
562+
const resultContent = toAcpContentUpdate(
563+
toolResult.content,
564+
"is_error" in toolResult ? toolResult.is_error : false,
565+
);
566+
567+
const content: ToolCallContent[] = [];
568+
if (url) {
569+
content.push({
570+
type: "content",
571+
content: resourceLink(url, url, {
572+
description: prompt,
573+
}),
574+
});
575+
}
576+
if (resultContent.content) {
577+
content.push(...resultContent.content);
578+
}
579+
580+
return { content };
581+
}
557582
default: {
558583
return toAcpContentUpdate(
559584
toolResult.content,

0 commit comments

Comments
 (0)