Files
jfeng d8796531ee feat: MCP Browser v3.1.1 - 56+ tools, visual overlays, fixes
- Added 9 new tools: visual overlay, highlight, toast, drag-drop, etc.
- Fixed evaluateJS to support function arguments
- Fixed hover for non-visible elements
- Fixed storage operations with try/catch
- Added 10 new wait tools: clickable, element visible, text
- Fixed tool name mapping in server.js for MCP protocol
- Updated README with 60+ tools documentation
- Version bump to 3.1.1
2026-04-07 16:29:38 -03:00

42 lines
1.2 KiB
JavaScript

const browser = require('../browser');
module.exports = async ({ message = 'Action', duration = 2000 }) => {
await browser.start();
const p = await browser.ensurePage();
await p.evaluate(({ msg, dur }) => {
let toast = document.getElementById('mcp-action-toast');
if (!toast) {
const toastEl = document.createElement('div');
toastEl.id = 'mcp-action-toast';
toastEl.style.cssText = `
position: fixed;
top: 20px;
right: 20px;
padding: 12px 20px;
background: rgba(16, 185, 129, 0.95);
color: white;
border-radius: 8px;
font-family: -apple-system, BlinkMacSystemFont, sans-serif;
font-size: 14px;
z-index: 999999;
transform: translateX(120%);
transition: transform 0.3s ease;
box-shadow: 0 4px 12px rgba(0,0,0,0.2);
`;
document.body.appendChild(toastEl);
toast = toastEl;
}
toast.textContent = msg;
toast.style.transform = 'translateX(0)';
setTimeout(() => {
toast.style.transform = 'translateX(120%)';
}, dur);
}, { msg: message, dur: duration });
return { success: true, action: 'show_toast', message };
};