Commit f84f873
committed
fix(puppeteer): return isError instead of internal error on navigation failure
puppeteer_navigate throws an unhandled Protocol error when given an
invalid URL (e.g., empty string, malformed URL). The CDP error
propagates as a JSON-RPC -32603 internal error, which prevents
agents from detecting and recovering from the failure.
Wrap page.goto() in a try/catch and return isError: true with the
error message, matching the pattern used by puppeteer_screenshot
and other tools in this server.
Reproduction:
mcp-assert audit --server "npx @modelcontextprotocol/server-puppeteer"
# puppeteer_navigate: CRASH (internal error)
Found with mcp-assert (https://github.com/blackwell-systems/mcp-assert)1 parent e247123 commit f84f873
1 file changed
Lines changed: 11 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
217 | 217 | | |
218 | 218 | | |
219 | 219 | | |
220 | | - | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
221 | 231 | | |
222 | 232 | | |
223 | 233 | | |
| |||
0 commit comments