Skip to content

Commit c502f62

Browse files
committed
addressing nits
1 parent 3307ef7 commit c502f62

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

src/lib/accessibility-snapshot.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ function walk(el) {
4343
if (role) node.role = role;
4444
if (name) node.name = name;
4545
if (el.id) node.id = el.id;
46-
if (tag.match(/^H[1-6]$/)) node.level = parseInt(tag[1]);
46+
if (/^H[1-6]$/.test(tag)) node.level = parseInt(tag[1], 10);
4747
if (el.href) node.href = el.href;
4848
if (el.disabled) node.disabled = true;
4949
if (el.checked) node.checked = true;

src/lib/server.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -880,7 +880,7 @@ server.registerResource(
880880
//-32002 is not in the SDK but is noted in the MCP specification:
881881
// https://modelcontextprotocol.io/specification/2025-11-25/server/resources#error-handling
882882
if (!driver) throw new McpError(-32002, "No active browser session. Start a browser first.");
883-
const tree = await driver.executeScript(accessibilitySnapshotScript);
883+
const tree = await driver.executeScript(accessibilitySnapshotScript) || {};
884884
return { contents: [{ uri: uri.href, mimeType: "application/json", text: JSON.stringify(tree, null, 2) }] };
885885
} catch (e) {
886886
if (e instanceof McpError) throw e;

0 commit comments

Comments
 (0)