@ejazullah/browser-mcp 0.0.66 → 0.0.67
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/lib/config.js +3 -0
- package/lib/program.js +2 -1
- package/lib/response.js +5 -2
- package/package.json +1 -1
package/lib/config.js
CHANGED
|
@@ -135,6 +135,7 @@ export function configFromCLIOptions(cliOptions) {
|
|
|
135
135
|
outputDir: cliOptions.outputDir,
|
|
136
136
|
imageResponses: cliOptions.imageResponses,
|
|
137
137
|
maxResponseChars: cliOptions.maxResponseChars ? parseInt(cliOptions.maxResponseChars, 10) : undefined,
|
|
138
|
+
actionSnapshots: cliOptions.actionSnapshots,
|
|
138
139
|
mongodb: {
|
|
139
140
|
url: cliOptions.mongodbUrl,
|
|
140
141
|
dbName: cliOptions.mongodbDb,
|
|
@@ -168,6 +169,8 @@ function configFromEnv() {
|
|
|
168
169
|
if (process.env.PLAYWRIGHT_MCP_IMAGE_RESPONSES === 'omit')
|
|
169
170
|
options.imageResponses = 'omit';
|
|
170
171
|
options.maxResponseChars = envToString(process.env.PLAYWRIGHT_MCP_MAX_RESPONSE_CHARS);
|
|
172
|
+
if (process.env.PLAYWRIGHT_MCP_ACTION_SNAPSHOTS === 'false' || process.env.PLAYWRIGHT_MCP_ACTION_SNAPSHOTS === '0')
|
|
173
|
+
options.actionSnapshots = false;
|
|
171
174
|
options.sandbox = envToBoolean(process.env.PLAYWRIGHT_MCP_SANDBOX);
|
|
172
175
|
options.outputDir = envToString(process.env.PLAYWRIGHT_MCP_OUTPUT_DIR);
|
|
173
176
|
options.port = envToNumber(process.env.PLAYWRIGHT_MCP_PORT);
|
package/lib/program.js
CHANGED
|
@@ -65,7 +65,8 @@ program
|
|
|
65
65
|
.option('--ignore-https-errors', 'ignore https errors')
|
|
66
66
|
.option('--isolated', 'keep the browser profile in memory, do not save it to disk.')
|
|
67
67
|
.option('--image-responses <mode>', 'whether to send image responses to the client. Can be "allow" or "omit", Defaults to "allow".')
|
|
68
|
-
.option('--max-response-chars <number>', 'Maximum characters to send in a single response. Default is
|
|
68
|
+
.option('--max-response-chars <number>', 'Maximum characters to send in a single response. Default is 40000.')
|
|
69
|
+
.option('--no-action-snapshots', 'disable automatic snapshots after tool actions like click and scroll.')
|
|
69
70
|
.option('--no-sandbox', 'disable the sandbox for all process types that are normally sandboxed.')
|
|
70
71
|
.option('--output-dir <path>', 'path to the directory for output files.')
|
|
71
72
|
.option('--port <port>', 'port to listen on for SSE transport.')
|
package/lib/response.js
CHANGED
|
@@ -58,6 +58,9 @@ export class Response {
|
|
|
58
58
|
return this._images;
|
|
59
59
|
}
|
|
60
60
|
setIncludeSnapshot(offsetLine) {
|
|
61
|
+
if (this._context.config.actionSnapshots === false && this.toolName !== 'browser_snapshot') {
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
61
64
|
this._includeSnapshot = true;
|
|
62
65
|
if (offsetLine !== undefined) {
|
|
63
66
|
this._snapshotOffsetLine = offsetLine;
|
|
@@ -109,14 +112,14 @@ ${this._code.join('\n')}
|
|
|
109
112
|
}
|
|
110
113
|
else if (this._tabSnapshot) {
|
|
111
114
|
const currentLength = response.join('\n').length;
|
|
112
|
-
const maxChars = this._context.config.maxResponseChars ??
|
|
115
|
+
const maxChars = this._context.config.maxResponseChars ?? 40000;
|
|
113
116
|
const remainingBudget = Math.max(1000, maxChars - currentLength);
|
|
114
117
|
response.push(renderTabSnapshot(this._tabSnapshot, remainingBudget, this._snapshotOffsetLine));
|
|
115
118
|
response.push('');
|
|
116
119
|
}
|
|
117
120
|
// Main response part
|
|
118
121
|
let responseText = response.join('\n');
|
|
119
|
-
const maxChars = this._context.config.maxResponseChars ??
|
|
122
|
+
const maxChars = this._context.config.maxResponseChars ?? 40000;
|
|
120
123
|
if (responseText.length > maxChars) {
|
|
121
124
|
responseText = responseText.slice(0, maxChars - 100) + '\n\n... [Response truncated due to length limits]';
|
|
122
125
|
}
|