browse: refactor tool responses to match claudetool patterns

This was vibe-coded, but the vibe was wrong.
Make it look like the rest of the code,
which will ease upcoming refactoring work.
Switch from JSON to XML-ish for textual tool outputs.

Co-Authored-By: sketch <hello@sketch.dev>
Change-ID: se50bf57009dfd97ak
diff --git a/loop/testdata/agent_loop.httprr b/loop/testdata/agent_loop.httprr
index 21c3b28..49e76da 100644
--- a/loop/testdata/agent_loop.httprr
+++ b/loop/testdata/agent_loop.httprr
@@ -1,9 +1,9 @@
 httprr trace v1
-20665 2568
+20692 2587
 POST https://api.anthropic.com/v1/messages HTTP/1.1

 Host: api.anthropic.com

 User-Agent: Go-http-client/1.1

-Content-Length: 20467

+Content-Length: 20494

 Anthropic-Version: 2023-06-01

 Content-Type: application/json

 

@@ -440,7 +440,7 @@
   },
   {
    "name": "browser_get_text",
-   "description": "Get the innerText of an element. Can be used to read the web page.",
+   "description": "Get the innerText of an element, returned in innerText tag. Can be used to read the web page.",
    "input_schema": {
     "type": "object",
     "properties": {
@@ -603,24 +603,24 @@
 Anthropic-Organization-Id: 3c473a21-7208-450a-a9f8-80aebda45c1b

 Anthropic-Ratelimit-Input-Tokens-Limit: 200000

 Anthropic-Ratelimit-Input-Tokens-Remaining: 200000

-Anthropic-Ratelimit-Input-Tokens-Reset: 2025-06-18T17:37:58Z

+Anthropic-Ratelimit-Input-Tokens-Reset: 2025-07-02T22:43:53Z

 Anthropic-Ratelimit-Output-Tokens-Limit: 80000

 Anthropic-Ratelimit-Output-Tokens-Remaining: 80000

-Anthropic-Ratelimit-Output-Tokens-Reset: 2025-06-18T17:38:05Z

+Anthropic-Ratelimit-Output-Tokens-Reset: 2025-07-02T22:44:03Z

 Anthropic-Ratelimit-Requests-Limit: 4000

 Anthropic-Ratelimit-Requests-Remaining: 3999

-Anthropic-Ratelimit-Requests-Reset: 2025-06-18T17:37:56Z

+Anthropic-Ratelimit-Requests-Reset: 2025-07-02T22:43:47Z

 Anthropic-Ratelimit-Tokens-Limit: 280000

 Anthropic-Ratelimit-Tokens-Remaining: 280000

-Anthropic-Ratelimit-Tokens-Reset: 2025-06-18T17:37:58Z

+Anthropic-Ratelimit-Tokens-Reset: 2025-07-02T22:43:53Z

 Cf-Cache-Status: DYNAMIC

-Cf-Ray: 951c8eb9ef9fcf1a-SJC

+Cf-Ray: 9591a9fb9af39e58-SJC

 Content-Type: application/json

-Date: Wed, 18 Jun 2025 17:38:05 GMT

-Request-Id: req_011CQG6NuhqCivuiY6qpfgrF

+Date: Wed, 02 Jul 2025 22:44:03 GMT

+Request-Id: req_011CQj12QtwdhXutWELw6Xs3

 Server: cloudflare

 Strict-Transport-Security: max-age=31536000; includeSubDomains; preload

 Via: 1.1 google

 X-Robots-Tag: none

 

-{"id":"msg_019AFgFq1PXMS9XCNuWC9mQt","type":"message","role":"assistant","model":"claude-sonnet-4-20250514","content":[{"type":"text","text":"Here are the tools available to me:\n\n**Code & File Management:**\n- `bash` - Execute shell commands\n- `patch` - Edit files with precise text operations\n- `keyword_search` - Search codebase by keywords/concepts\n\n**Task Management:**\n- `todo_read` / `todo_write` - Track and manage task lists\n- `think` - Record thoughts and plans\n\n**Git & Development:**\n- `commit-message-style` - Get git commit message guidance\n- `codereview` - Run automated code review\n- `done` - Complete tasks with verification checklist\n\n**Browser Automation:**\n- `browser_navigate` - Navigate to URLs\n- `browser_click` - Click elements\n- `browser_type` - Type text into inputs\n- `browser_wait_for` - Wait for elements\n- `browser_get_text` - Read page text\n- `browser_eval` - Execute JavaScript\n- `browser_scroll_into_view` - Scroll to elements\n- `browser_resize` - Resize browser window\n- `browser_take_screenshot` - Capture screenshots\n- `browser_recent_console_logs` / `browser_clear_console_logs` - Manage console logs\n\n**Utilities:**\n- `read_image` - Read and encode image files\n- `multiplechoice` - Present multiple choice questions\n- `about_sketch` - Get information about Sketch environment\n- `set-slug` - Set conversation identifier"}],"stop_reason":"end_turn","stop_sequence":null,"usage":{"input_tokens":3,"cache_creation_input_tokens":4734,"cache_read_input_tokens":0,"output_tokens":332,"service_tier":"standard"}}
\ No newline at end of file
+{"id":"msg_01UtTaMqbCD6qFYqz7s8w1Yi","type":"message","role":"assistant","model":"claude-sonnet-4-20250514","content":[{"type":"text","text":"Here are the tools available to me:\n\n**File & Code Management:**\n- `bash` - Execute shell commands\n- `patch` - Modify files with precise text edits\n- `keyword_search` - Search codebase by keywords\n\n**Task Management:**\n- `todo_read` - Read current todo list\n- `todo_write` - Create and manage task lists\n- `think` - Record thoughts and plans\n\n**Git & Code Quality:**\n- `commit-message-style` - Get git commit message guidance\n- `codereview` - Run automated code review\n- `done` - Complete work with verification checklist\n\n**Browser Automation:**\n- `browser_navigate` - Navigate to URLs\n- `browser_click` - Click elements\n- `browser_type` - Type text into inputs\n- `browser_wait_for` - Wait for elements\n- `browser_get_text` - Read element text\n- `browser_eval` - Execute JavaScript\n- `browser_scroll_into_view` - Scroll to elements\n- `browser_resize` - Resize browser window\n- `browser_take_screenshot` - Capture screenshots\n- `browser_recent_console_logs` - Get console logs\n- `browser_clear_console_logs` - Clear console logs\n\n**Utility:**\n- `set-slug` - Set conversation identifier\n- `about_sketch` - Get Sketch platform help\n- `multiplechoice` - Present multiple choice questions\n- `read_image` - Read and encode image files"}],"stop_reason":"end_turn","stop_sequence":null,"usage":{"input_tokens":3,"cache_creation_input_tokens":4740,"cache_read_input_tokens":0,"output_tokens":342,"service_tier":"standard"}}
\ No newline at end of file