@olib-ai/owl-browser-mcp 1.0.1 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +33 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -22297,6 +22297,10 @@ var openapi_default = {
|
|
|
22297
22297
|
selector: {
|
|
22298
22298
|
type: "string",
|
|
22299
22299
|
description: "CSS selector or natural language description for the element to capture. Required when mode is 'element'. Examples: 'div.profile', '#submit-btn', 'the login form'"
|
|
22300
|
+
},
|
|
22301
|
+
scale: {
|
|
22302
|
+
type: "integer",
|
|
22303
|
+
description: "Scale percentage for the output image (1-100). Default is 100 (no scaling). Example: 50 will return an image at 50% of the original size (half width and height)."
|
|
22300
22304
|
}
|
|
22301
22305
|
},
|
|
22302
22306
|
required: [
|
|
@@ -26917,6 +26921,35 @@ function formatResponse(toolName, result) {
|
|
|
26917
26921
|
};
|
|
26918
26922
|
}
|
|
26919
26923
|
const data = result.data;
|
|
26924
|
+
const isImageTool = toolName === "browser_screenshot" || toolName === "browser_get_live_frame";
|
|
26925
|
+
if (isImageTool) {
|
|
26926
|
+
let base64Data = null;
|
|
26927
|
+
if (typeof data === "object" && data !== null) {
|
|
26928
|
+
const dataObj = data;
|
|
26929
|
+
if (typeof dataObj.result === "string") {
|
|
26930
|
+
base64Data = dataObj.result;
|
|
26931
|
+
} else if (typeof dataObj.success === "boolean" && typeof dataObj.result === "string") {
|
|
26932
|
+
base64Data = dataObj.result;
|
|
26933
|
+
}
|
|
26934
|
+
} else if (typeof data === "string") {
|
|
26935
|
+
base64Data = data;
|
|
26936
|
+
}
|
|
26937
|
+
if (base64Data) {
|
|
26938
|
+
if (base64Data.startsWith("data:image/")) {
|
|
26939
|
+
const [, actualBase64] = base64Data.split(",");
|
|
26940
|
+
base64Data = actualBase64;
|
|
26941
|
+
}
|
|
26942
|
+
return {
|
|
26943
|
+
content: [
|
|
26944
|
+
{
|
|
26945
|
+
type: "image",
|
|
26946
|
+
data: base64Data,
|
|
26947
|
+
mimeType: "image/png"
|
|
26948
|
+
}
|
|
26949
|
+
]
|
|
26950
|
+
};
|
|
26951
|
+
}
|
|
26952
|
+
}
|
|
26920
26953
|
if (typeof data === "object" && data !== null && "image" in data) {
|
|
26921
26954
|
const imageData = data.image;
|
|
26922
26955
|
if (imageData.startsWith("data:image/")) {
|