Skip to content

The JavaScript tool is returning a Promise. Let me try a different approach. #1497

@entrptaher

Description

@entrptaher

I've been using this mcp heavily and been impressed by it so far. Great work!

For a long time, I have been hitting this issue with the mcp with opencode where it keeps failing with a promise related notice.

The JavaScript tool is returning a Promise. Let me try a different approach - use a direct expression without JSON.stringify, or use a simpler query.
⚙openchrome_javascript_tool [tabId=A5B44DC8096ADE6B09D8636C2D9A9A96, code=
(() => {
  const header = document.querySelector('header.z-30');
  const sidebar = document.querySelector('aside.ssr-sidebar-desktop');
  const mobileNav = document.querySelector('nav.ssr-sidebar-mobile');
  
  return {
    headerBg: header ? window.getComputedStyle(header).backgroundColor : 'not found',
    sidebarBg: sidebar ? window.getComputedStyle(sidebar).backgroundColor : 'not found',
    mobileNavBg: mobileNav ? window.getComputedStyle(mobileNav).backgroundColor : 'not found',
    htmlAttr: document.documentElement.getAttribute('data-high-end'),
    viewport: document.documentElement.getAttribute('data-viewport'),
  };
})();
]
Thought: 263ms
The JavaScript tool keeps returning a Promise. Let me try using read_page with mode="dom" or just use the inspect tool to see the page state. Or I can use the query_dom tool. Let me try query_dom.

It wastes turns, tokens and time.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions