@mseep/hyperbrowser-mcp
Version:
Hyperbrowser Model Context Protocol Server
73 lines (68 loc) • 2.78 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.browserUseToolDescription = exports.browserUseToolName = exports.browserUseTool = void 0;
const utils_1 = require("../utils");
async function browserUseTool({ task, sessionOptions, returnStepInfo, maxSteps, }) {
try {
const client = await (0, utils_1.getClient)();
const result = await client.agents.browserUse.startAndWait({
task,
sessionOptions,
maxSteps,
});
if (result.error) {
return {
isError: true,
content: [
{
type: "text",
text: result.error,
},
],
};
}
const response = {
content: [],
isError: false,
};
if (result.data) {
let taskData = result.data;
if (!returnStepInfo) {
taskData.steps = [];
}
response.content.push({
type: "text",
text: JSON.stringify(taskData),
});
}
else {
response.content.push({
type: "text",
text: "Task result data is empty/missing",
isError: true,
});
}
return response;
}
catch (error) {
return {
content: [{ type: "text", text: `${error}` }],
isError: true,
};
}
}
exports.browserUseTool = browserUseTool;
exports.browserUseToolName = "browser_use_agent";
exports.browserUseToolDescription = `
This tool employs an open-source browser automation agent optimized specifically for fast, efficient, and cost-effective browser tasks using a cloud browser. It requires explicit, detailed instructions to perform highly specific interactions quickly.
Optimal for tasks requiring:
- Precise, explicitly defined interactions and actions
- Speed and efficiency with clear, unambiguous instructions
- Cost-effective automation at scale with straightforward workflows
Best suited use cases include:
- Explicitly defined registration and login processes
- Clearly guided navigation through web apps
- Structured, step-by-step web scraping with detailed guidance
- Extracting data via explicitly specified browser interactions
You must provide extremely detailed step-by-step instructions, including exact elements, actions, and explicit context. Clearly define the desired outcome for optimal results. Returns the completed result or an error message if issues arise.
Note: This agent trades off flexibility for significantly faster performance and lower costs compared to Claude and OpenAI agents.`.trim();