控制台
🌐 Console
访问浏览器控制台输出以进行调试。browser_console_messages 是 核心 功能的一部分,总是可用的。
🌐 Access browser console output for debugging. browser_console_messages is part of the core capability and always available.
browser_console_messages
返回当前标签收集的控制台消息,并附带计数摘要。
🌐 Returns the console messages collected for the current tab, preceded by a count summary.
| 参数 | 类型 | 必填 | 描述 |
|---|---|---|---|
level | 字符串 | 否 | 最低等级:error、warning、info(默认)、debug。每个等级包含更严重等级的消息 |
all | 布尔值 | 否 | 返回自会话开始以来的所有消息,而不仅仅是自上次导航以来的消息。默认值为 false |
filename | 字符串 | 否 | 将消息保存到文件中,而不是以文本形式返回 |
→ browser_console_messages
Total messages: 4 (Errors: 1, Warnings: 1)
[ERROR] Uncaught TypeError: Cannot read property 'map' of undefined @ app.js:42
[WARNING] Deprecation: 'window.webkitStorageInfo' is deprecated.
[LOG] App initialized in 234ms
[LOG] User session restored
→ browser_console_messages { level: "error" }
Total messages: 4 (Errors: 1, Warnings: 1)
Returning 1 messages for level "error"
[ERROR] Uncaught TypeError: Cannot read property 'map' of undefined @ app.js:42
工具的响应还带有一条 - New console entries: 行,指向自上次响应以来记录的消息,这样大语言模型就知道什么时候值得调用这个工具。
🌐 Tool responses also carry a - New console entries: line pointing at the messages logged since the previous response, so the LLM knows when it is worth calling this tool.
整个会话的默认级别可以用 --console-level=<level> 设置。
🌐 The default level for the whole session can be set with --console-level=<level>.
工作流程:调试损坏的页面
🌐 Workflow: debugging a broken page
You: The page looks broken. Check the console for errors.
→ browser_console_messages { level: "error" }
[ERROR] Failed to fetch: GET https://api.example.com/data 404
[ERROR] Uncaught Error: API returned 404
→ browser_network_requests { filter: "api" }
// Confirm the failing request, then mock it or investigate further