mcp-browser-dev-tools 0.5.2 → 0.5.3

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/README.md CHANGED
@@ -47,7 +47,7 @@ Your agent gets 46 browser tools over MCP: open or attach to tabs, click, type,
47
47
  - **Right where you work.** It attaches to the browser you already use, with its logins, tabs, and extensions, and speaks to Chrome, Edge, and Firefox with the same tools.
48
48
  - **A debugger at hand.** Console messages with stack traces, network requests and HAR export, cookies and storage, and a one-call debug report.
49
49
 
50
- Against Playwright MCP and Chrome DevTools MCP, on the same tasks with six models, it took the fewest turns and the least time with every model, while Playwright MCP cost less with five of the six: see the [comparison](https://hinaser.github.io/mcp-browser-dev-tools/).
50
+ Against Playwright MCP and Chrome DevTools MCP, on the same tasks with six models, it took the fewest turns and the least time with every model and cost the least on average, while Playwright MCP cost less with four of the six: see the [comparison](https://hinaser.github.io/mcp-browser-dev-tools/).
51
51
 
52
52
  ## One Call, Start To Finish
53
53
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mcp-browser-dev-tools",
3
- "version": "0.5.2",
3
+ "version": "0.5.3",
4
4
  "description": "Browser MCP server for AI agents: batch actions, waits, and checks into one call on Chrome, Edge, or Firefox (CDP and WebDriver BiDi)",
5
5
  "author": "Hinaser <rindo.hinase@gmail.com>",
6
6
  "license": "MIT",
@@ -75,6 +75,9 @@ const STATUS_PROBE_ATTEMPTS = 3;
75
75
 
76
76
  const LAUNCH_GRACE_MS = 30_000;
77
77
 
78
+ const INSTRUCTIONS =
79
+ "Start with attach_tab. To act, prefer run_steps: send the actions you already know, such as every field of a form, in one call.";
80
+
78
81
  // The definition clients see: additionalProperties: false tells a model
79
82
  // nothing it acts on, so it is left out of what every turn pays for, and
80
83
  // sessionId is not required, since a call without it uses the default
@@ -404,7 +407,12 @@ export class McpBrowserDevToolsServer {
404
407
  name: SERVER_NAME,
405
408
  version: SERVER_VERSION,
406
409
  },
407
- instructions: `Start with attach_tab, by the tab's url or a targetId from list_tabs or new_tab: it returns the page's snapshot, one line per visible heading and control with a ref such as e12 (f1e3 inside an iframe, which only refs reach). Tools then act on the tab attached last unless given another sessionId. To act, prefer run_steps: send the actions you already know, such as every field of a form, in one call: {"steps":[{"tool":"type","arguments":{"selector":"ref=e3","text":"Ada"}},{"tool":"click","arguments":{"selector":"ref=e4"}}]}. Actions return what changed once the page settles, which is usually the check; add wait_for only for something later. Read several pages at once with run_tabs. Locators, case-sensitive: ref=e12 until the page navigates; CSS; text=Foo and name=Foo, the first visible element whose text or accessible name equals, else contains, Foo (a label finds its control); role=button[name="Save"]; a >> b for b inside a, and has-text=Foo to filter: tr >> has-text=Ada >> text=Delete. more_tools lists and calls the other tools (drag, cookies, request mocking, HAR, performance).`,
410
+ // One sentence: the rest of the guidance is in the tool
411
+ // descriptions. The Codex CLI appends a server's instructions to
412
+ // every one of its tools when the model lists them, so GPT
413
+ // models pay for 24 copies; Claude Code gives them more weight
414
+ // than a description, and without this one agents batched less.
415
+ instructions: INSTRUCTIONS,
408
416
  });
409
417
  case "notifications/initialized":
410
418
  return null;
package/src/run-steps.mjs CHANGED
@@ -831,7 +831,7 @@ export function runStepsTool(runner) {
831
831
  {
832
832
  definition: {
833
833
  name: "run_steps",
834
- description: `Run session tools in order in one call: [{"tool":"type","arguments":{"selector":"ref=e3","text":"Ada"}},{"tool":"click","arguments":{"selector":"text=Save"}}]. Arguments omit sessionId. Also: sleep {ms}; if {condition, then, elseIf: [{condition, then}], else, timeoutMs}, which branches on wait_for fields, checked once or until one holds within timeoutMs; repeat {steps, until, max (default ${DEFAULT_REPEAT})}, which reruns steps until until holds. All steps are validated first. A step fails when it throws or reports found: false (not inspect_element); the batch stops there unless continueOnError and reports the page's controls. A batch with actions returns one changes for the whole batch. A step that reads the page after an action or navigation first waits for the page to settle, so it needs no sleep.`,
834
+ description: `Run session tools in order in one call; prefer it to separate calls for the actions you already know, such as every field of a form: [{"tool":"type","arguments":{"selector":"ref=e3","text":"Ada"}},{"tool":"click","arguments":{"selector":"text=Save"}}]. Arguments omit sessionId. Also: sleep {ms}; if {condition, then, elseIf: [{condition, then}], else, timeoutMs}, which branches on wait_for fields, checked once or until one holds within timeoutMs; repeat {steps, until, max (default ${DEFAULT_REPEAT})}, which reruns steps until until holds. All steps are validated first. A step fails when it throws or reports found: false (not inspect_element); the batch stops there unless continueOnError and reports the page's controls. A batch with actions returns one changes for the whole batch. A step that reads the page after an action or navigation first waits for the page to settle, so it needs no sleep.`,
835
835
  inputSchema: runStepsInputSchema(),
836
836
  },
837
837
  handler: async (args) => runner.runSteps(args),
@@ -3,7 +3,7 @@ export function asToolResult(value) {
3
3
  content: [
4
4
  {
5
5
  type: "text",
6
- text: JSON.stringify(value, null, 2),
6
+ text: JSON.stringify(value),
7
7
  },
8
8
  ],
9
9
  structuredContent: value,
@@ -15,7 +15,7 @@ export function asImageToolResult({ value, images }) {
15
15
  content: [
16
16
  {
17
17
  type: "text",
18
- text: JSON.stringify(value, null, 2),
18
+ text: JSON.stringify(value),
19
19
  },
20
20
  ...images,
21
21
  ],
@@ -84,7 +84,7 @@ export function actionTools(server) {
84
84
  definition: {
85
85
  name: "click",
86
86
  description:
87
- "Click with real mouse input at an element's center (fails if something covers it) or at x, y. Accepts alert and confirm dialogs, dismisses prompts. Returns changes: what changed on the page.",
87
+ 'Click with real mouse input at an element\'s center (fails if something covers it) or at x, y. Accepts alert and confirm dialogs, dismisses prompts. Returns changes: what changed on the page. Locators in every tool are case-sensitive: ref=e12 until the page navigates; CSS; text=Foo and name=Foo, the first visible element whose text or accessible name equals, else contains, Foo (a label finds its control); role=button[name="Save"]; a >> b for b inside a, and has-text=Foo to filter: tr >> has-text=Ada >> text=Delete. Only refs reach into iframes.',
88
88
  inputSchema: sessionSchema(
89
89
  {
90
90
  selector: selectorProperty(),
@@ -180,7 +180,7 @@ export function browserTools(server) {
180
180
  definition: {
181
181
  name: "attach_tab",
182
182
  description:
183
- "Attach to a tab: returns the sessionId other tools take and the page's snapshot, as get_snapshot lists it, and buffers its console and network events from now on.",
183
+ "Start here: attach to a tab by its url, or a targetId from list_tabs or new_tab. Returns the page's snapshot, one line per visible heading and control with a ref such as e12 (f1e3 inside an iframe), and buffers the tab's console and network events from now on. Later calls without sessionId act on the tab attached last.",
184
184
  inputSchema: {
185
185
  type: "object",
186
186
  properties: {
@@ -189,7 +189,7 @@ export function stateTools(server) {
189
189
  definition: {
190
190
  name: "wait_for",
191
191
  description:
192
- "Wait until every given condition holds, or the first of anyOf; at timeoutMs it fails with the last observed state. Selector checks scroll the element into view.",
192
+ "Wait until every given condition holds, or the first of anyOf; at timeoutMs it fails with the last observed state. Selector checks scroll the element into view. Actions already return what changed once the page settles, so wait only for something that comes later.",
193
193
  inputSchema: waitForInputSchema({
194
194
  expression: server.config.enableEvaluate,
195
195
  }),