UNPKG

@mseep/hyperbrowser-mcp

Version:

Hyperbrowser Model Context Protocol Server

72 lines (68 loc) 2.61 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.oaiCuaToolDescription = exports.oaiCuaToolName = exports.oaiCuaTool = void 0; const utils_1 = require("../utils"); async function oaiCuaTool({ task, sessionOptions, returnStepInfo, maxSteps, }) { try { const client = await (0, utils_1.getClient)(); const result = await client.agents.cua.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 = []; } const toolResultText = `Final Result: ${taskData.finalResult}\n\nSteps: ${JSON.stringify(taskData.steps, null, 2)}`; response.content.push({ type: "text", text: toolResultText, }); } 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.oaiCuaTool = oaiCuaTool; exports.oaiCuaToolName = "openai_computer_use_agent"; exports.oaiCuaToolDescription = ` This tool utilizes OpenAI's model to autonomously execute general-purpose browser-based tasks with balanced performance and reliability using a cloud browser. It handles complex interactions effectively with practical reasoning and clear execution. Optimal for tasks requiring: - Reliable, general-purpose browser automation - Clear, structured interactions with moderate complexity - Efficient handling of common web tasks and workflows Best suited use cases include: - Standard multi-step registration or form submissions - Navigating typical web applications requiring multiple interactions - Conducting structured web research tasks - Extracting data through interactive web processes Provide a clear step-by-step description, necessary context, and expected outcomes. Returns the completed result or an error message if issues arise.`.trim();