fix(tools): use boolean error flag in web_fetch and web_search error responses

Return error: true (boolean) with code field instead of error: "string_code"
to match ToolErrorPayload convention. Also update runner.ts formatRunLogToolSummary
to prefer details.code for error categorization.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Jiayuan Zhang 2026-02-15 18:47:37 +08:00
parent b007ddffc8
commit 02ed09b77b
2 changed files with 6 additions and 3 deletions

View file

@ -343,12 +343,14 @@ export function createWebFetchTool(): AgentTool<typeof WebFetchSchema, unknown>
} catch (error) {
if (error instanceof SsrfBlockedError) {
return jsonResult({
error: "ssrf_blocked",
error: true,
code: "ssrf_blocked",
message: error.message,
});
}
return jsonResult({
error: "fetch_failed",
error: true,
code: "fetch_failed",
message: error instanceof Error ? error.message : String(error),
});
}

View file

@ -135,7 +135,8 @@ export function createWebSearchTool(): AgentTool<typeof WebSearchSchema, unknown
return jsonResult(result);
} catch (error) {
return jsonResult({
error: "search_failed",
error: true,
code: "search_failed",
message: error instanceof Error ? error.message : String(error),
});
}