@cotestdev/mcp_playwright 0.0.57 → 0.0.58

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.
@@ -236,10 +236,8 @@ class Context {
236
236
  const result = await this._browserContextFactory.createContext(this._clientInfo, this._abortController.signal, { toolName: this._runningToolName });
237
237
  const { browserContext } = result;
238
238
  if (!this.config.allowUnrestrictedFileAccess) {
239
- if (typeof browserContext._setAllowedProtocols === "function")
240
- browserContext._setAllowedProtocols(["http:", "https:", "about:", "data:"]);
241
- if (typeof browserContext._setAllowedDirectories === "function")
242
- browserContext._setAllowedDirectories(allRootPaths(this._clientInfo));
239
+ browserContext._setAllowedProtocols(["http:", "https:", "about:", "data:"]);
240
+ browserContext._setAllowedDirectories(allRootPaths(this._clientInfo));
243
241
  }
244
242
  await this._setupRequestInterception(browserContext);
245
243
  for (const page of browserContext.pages())
@@ -24,7 +24,6 @@ module.exports = __toCommonJS(common_exports);
24
24
  var import_mcpBundle = require("../../../mcpBundle");
25
25
  var import_tool = require("./tool");
26
26
  var import_response = require("../response");
27
- var import_schema = require("./schema");
28
27
  const close = (0, import_tool.defineTool)({
29
28
  capability: "core",
30
29
  schema: {
@@ -47,7 +46,7 @@ const resize = (0, import_tool.defineTabTool)({
47
46
  name: "browser_resize",
48
47
  title: "Resize browser window",
49
48
  description: "Resize the browser window",
50
- inputSchema: import_schema.baseSchema.extend({
49
+ inputSchema: import_mcpBundle.z.object({
51
50
  width: import_mcpBundle.z.number().describe("Width of the browser window"),
52
51
  height: import_mcpBundle.z.number().describe("Height of the browser window")
53
52
  }),
@@ -24,14 +24,13 @@ __export(dialogs_exports, {
24
24
  module.exports = __toCommonJS(dialogs_exports);
25
25
  var import_mcpBundle = require("../../../mcpBundle");
26
26
  var import_tool = require("./tool");
27
- var import_schema = require("./schema");
28
27
  const handleDialog = (0, import_tool.defineTabTool)({
29
28
  capability: "core",
30
29
  schema: {
31
30
  name: "browser_handle_dialog",
32
31
  title: "Handle a dialog",
33
32
  description: "Handle a dialog",
34
- inputSchema: import_schema.baseSchema.extend({
33
+ inputSchema: import_mcpBundle.z.object({
35
34
  accept: import_mcpBundle.z.boolean().describe("Whether to accept the dialog."),
36
35
  promptText: import_mcpBundle.z.string().optional().describe("The text of the prompt in case of a prompt dialog.")
37
36
  }),
@@ -24,8 +24,7 @@ module.exports = __toCommonJS(evaluate_exports);
24
24
  var import_mcpBundle = require("../../../mcpBundle");
25
25
  var import_utils = require("playwright-core/lib/utils");
26
26
  var import_tool = require("./tool");
27
- var import_schema = require("./schema");
28
- const evaluateSchema = import_schema.baseSchema.extend({
27
+ const evaluateSchema = import_mcpBundle.z.object({
29
28
  function: import_mcpBundle.z.string().describe("() => { /* code */ } or (element) => { /* code */ } when element is provided"),
30
29
  element: import_mcpBundle.z.string().optional().describe("Human-readable element description used to obtain permission to interact with the element"),
31
30
  ref: import_mcpBundle.z.string().optional().describe("Exact target element reference from the page snapshot")
@@ -24,14 +24,13 @@ __export(files_exports, {
24
24
  module.exports = __toCommonJS(files_exports);
25
25
  var import_mcpBundle = require("../../../mcpBundle");
26
26
  var import_tool = require("./tool");
27
- var import_schema = require("./schema");
28
27
  const uploadFile = (0, import_tool.defineTabTool)({
29
28
  capability: "core",
30
29
  schema: {
31
30
  name: "browser_file_upload",
32
31
  title: "Upload files",
33
32
  description: "Upload one or multiple files",
34
- inputSchema: import_schema.baseSchema.extend({
33
+ inputSchema: import_mcpBundle.z.object({
35
34
  paths: import_mcpBundle.z.array(import_mcpBundle.z.string()).optional().describe("The absolute paths to the files to upload. Can be single file or multiple files. If omitted, file chooser is cancelled.")
36
35
  }),
37
36
  type: "action"
@@ -24,14 +24,13 @@ module.exports = __toCommonJS(form_exports);
24
24
  var import_mcpBundle = require("../../../mcpBundle");
25
25
  var import_utils = require("playwright-core/lib/utils");
26
26
  var import_tool = require("./tool");
27
- var import_schema = require("./schema");
28
27
  const fillForm = (0, import_tool.defineTabTool)({
29
28
  capability: "core",
30
29
  schema: {
31
30
  name: "browser_fill_form",
32
31
  title: "Fill form",
33
32
  description: "Fill multiple form fields",
34
- inputSchema: import_schema.baseSchema.extend({
33
+ inputSchema: import_mcpBundle.z.object({
35
34
  fields: import_mcpBundle.z.array(import_mcpBundle.z.object({
36
35
  name: import_mcpBundle.z.string().describe("Human-readable field name"),
37
36
  type: import_mcpBundle.z.enum(["textbox", "checkbox", "radio", "combobox", "slider"]).describe("Type of the field"),
@@ -24,14 +24,13 @@ module.exports = __toCommonJS(keyboard_exports);
24
24
  var import_mcpBundle = require("../../../mcpBundle");
25
25
  var import_tool = require("./tool");
26
26
  var import_snapshot = require("./snapshot");
27
- var import_schema = require("./schema");
28
27
  const press = (0, import_tool.defineTabTool)({
29
28
  capability: "core-input",
30
29
  schema: {
31
30
  name: "browser_press_key",
32
31
  title: "Press a key",
33
32
  description: "Press a key on the keyboard",
34
- inputSchema: import_schema.baseSchema.extend({
33
+ inputSchema: import_mcpBundle.z.object({
35
34
  key: import_mcpBundle.z.string().describe("Name of the key to press or a character to generate, such as `ArrowLeft` or `a`")
36
35
  }),
37
36
  type: "input"
@@ -56,7 +55,7 @@ const pressSequentially = (0, import_tool.defineTabTool)({
56
55
  name: "browser_press_sequentially",
57
56
  title: "Type text key by key",
58
57
  description: "Type text key by key on the keyboard",
59
- inputSchema: import_schema.baseSchema.extend({
58
+ inputSchema: import_mcpBundle.z.object({
60
59
  text: import_mcpBundle.z.string().describe("Text to type"),
61
60
  submit: import_mcpBundle.z.boolean().optional().describe("Whether to submit entered text (press Enter after)")
62
61
  }),
@@ -116,7 +115,7 @@ const keydown = (0, import_tool.defineTabTool)({
116
115
  name: "browser_keydown",
117
116
  title: "Press a key down",
118
117
  description: "Press a key down on the keyboard",
119
- inputSchema: import_schema.baseSchema.extend({
118
+ inputSchema: import_mcpBundle.z.object({
120
119
  key: import_mcpBundle.z.string().describe("Name of the key to press or a character to generate, such as `ArrowLeft` or `a`")
121
120
  }),
122
121
  type: "input"
@@ -133,7 +132,7 @@ const keyup = (0, import_tool.defineTabTool)({
133
132
  name: "browser_keyup",
134
133
  title: "Press a key up",
135
134
  description: "Press a key up on the keyboard",
136
- inputSchema: import_schema.baseSchema.extend({
135
+ inputSchema: import_mcpBundle.z.object({
137
136
  key: import_mcpBundle.z.string().describe("Name of the key to press or a character to generate, such as `ArrowLeft` or `a`")
138
137
  }),
139
138
  type: "input"
@@ -23,14 +23,13 @@ __export(navigate_exports, {
23
23
  module.exports = __toCommonJS(navigate_exports);
24
24
  var import_mcpBundle = require("../../../mcpBundle");
25
25
  var import_tool = require("./tool");
26
- var import_schema = require("./schema");
27
26
  const navigate = (0, import_tool.defineTool)({
28
27
  capability: "core-navigation",
29
28
  schema: {
30
29
  name: "browser_navigate",
31
30
  title: "Navigate to a URL",
32
31
  description: "Navigate to a URL",
33
- inputSchema: import_schema.baseSchema.extend({
32
+ inputSchema: import_mcpBundle.z.object({
34
33
  url: import_mcpBundle.z.string().describe("The URL to navigate to")
35
34
  }),
36
35
  type: "action"
@@ -57,7 +56,7 @@ const goBack = (0, import_tool.defineTabTool)({
57
56
  name: "browser_navigate_back",
58
57
  title: "Go back",
59
58
  description: "Go back to the previous page in the history",
60
- inputSchema: import_schema.baseSchema.extend({}),
59
+ inputSchema: import_mcpBundle.z.object({}),
61
60
  type: "action"
62
61
  },
63
62
  handle: async (tab, params, response) => {
@@ -73,7 +72,7 @@ const goForward = (0, import_tool.defineTabTool)({
73
72
  name: "browser_navigate_forward",
74
73
  title: "Go forward",
75
74
  description: "Go forward to the next page in the history",
76
- inputSchema: import_schema.baseSchema.extend({}),
75
+ inputSchema: import_mcpBundle.z.object({}),
77
76
  type: "action"
78
77
  },
79
78
  handle: async (tab, params, response) => {
@@ -89,7 +88,7 @@ const reload = (0, import_tool.defineTabTool)({
89
88
  name: "browser_reload",
90
89
  title: "Reload the page",
91
90
  description: "Reload the current page",
92
- inputSchema: import_schema.baseSchema.extend({}),
91
+ inputSchema: import_mcpBundle.z.object({}),
93
92
  type: "action"
94
93
  },
95
94
  handle: async (tab, params, response) => {
@@ -34,10 +34,8 @@ module.exports = __toCommonJS(runCode_exports);
34
34
  var import_vm = __toESM(require("vm"));
35
35
  var import_utils = require("playwright-core/lib/utils");
36
36
  var import_mcpBundle = require("../../../mcpBundle");
37
- var import_ai_runner_fake = require("@cotestdev/ai-runner-fake");
38
37
  var import_tool = require("./tool");
39
- var import_schema = require("./schema");
40
- const codeSchema = import_schema.baseSchema.extend({
38
+ const codeSchema = import_mcpBundle.z.object({
41
39
  code: import_mcpBundle.z.string().describe(`A JavaScript function containing Playwright code to execute. It will be invoked with a single argument, page, which you can use for any page interaction. For example: \`async (page) => { await page.getByRole('button', { name: 'Submit' }).click(); return await page.title(); }\``)
42
40
  });
43
41
  const runCode = (0, import_tool.defineTabTool)({
@@ -73,33 +71,6 @@ const runCode = (0, import_tool.defineTabTool)({
73
71
  });
74
72
  }
75
73
  });
76
- const scriptSchema = import_mcpBundle.z.object({
77
- code: import_mcpBundle.z.string().describe(`A JavaScript function containing Playwright code to execute. It will be invoked with a single argument, page, which you can use for any page interaction. For example: \`async (page) => { await page.getByRole('button', { name: 'Submit' }).click(); return await page.title(); }\``),
78
- params: import_mcpBundle.z.record(import_mcpBundle.z.string(), import_mcpBundle.z.any()).optional().describe("Parameters to pass to the script."),
79
- projectId: import_mcpBundle.z.string().describe("Project ID"),
80
- testId: import_mcpBundle.z.string().describe("Test ID")
81
- });
82
- const runScript = (0, import_tool.defineTabTool)({
83
- capability: "extra",
84
- schema: {
85
- name: "run_test_script",
86
- title: "Run test script with runner",
87
- description: "Run Playwright script",
88
- inputSchema: scriptSchema,
89
- type: "action"
90
- },
91
- handle: async (tab, params, response) => {
92
- response.setIncludeSnapshot();
93
- const runner = import_ai_runner_fake.Runner.NewInstance(params.projectId, params.testId);
94
- await runner.init(tab.page, tab.page.context(), params.params);
95
- const result = await runner.runScript(params.testId, params.code);
96
- const code = `// Returns the out parameters of the reusable test
97
- const result = await runner.reuseTest('${params.testId}');`;
98
- response.addCode(code);
99
- response.addTextResult(`Out Parameters: ${JSON.stringify(result)}`);
100
- }
101
- });
102
74
  var runCode_default = [
103
- runCode,
104
- runScript
75
+ runCode
105
76
  ];
@@ -27,8 +27,7 @@ var import_utilsBundle = require("playwright-core/lib/utilsBundle");
27
27
  var import_utils2 = require("playwright-core/lib/utils");
28
28
  var import_mcpBundle = require("../../../mcpBundle");
29
29
  var import_tool = require("./tool");
30
- var import_schema = require("./schema");
31
- const screenshotSchema = import_schema.baseSchema.extend({
30
+ const screenshotSchema = import_mcpBundle.z.object({
32
31
  type: import_mcpBundle.z.enum(["png", "jpeg"]).default("png").describe("Image format for the screenshot. Default is png."),
33
32
  filename: import_mcpBundle.z.string().optional().describe("File name to save the screenshot to. Defaults to `page-{timestamp}.{png|jpeg}` if not specified. Prefer relative file names to stay within the output directory."),
34
33
  element: import_mcpBundle.z.string().optional().describe("Human-readable element description used to obtain permission to screenshot the element. If not provided, the screenshot will be taken of viewport. If element is provided, ref must be provided too."),
@@ -25,7 +25,6 @@ module.exports = __toCommonJS(snapshot_exports);
25
25
  var import_mcpBundle = require("../../../mcpBundle");
26
26
  var import_utils = require("playwright-core/lib/utils");
27
27
  var import_tool = require("./tool");
28
- var import_schema = require("./schema");
29
28
  const snapshot = (0, import_tool.defineTool)({
30
29
  capability: "core",
31
30
  schema: {
@@ -42,7 +41,7 @@ const snapshot = (0, import_tool.defineTool)({
42
41
  response.setIncludeFullSnapshot(params.filename);
43
42
  }
44
43
  });
45
- const elementSchema = import_schema.baseSchema.extend({
44
+ const elementSchema = import_mcpBundle.z.object({
46
45
  element: import_mcpBundle.z.string().optional().describe("Human-readable element description used to obtain permission to interact with the element"),
47
46
  ref: import_mcpBundle.z.string().describe("Exact target element reference from the page snapshot")
48
47
  });
@@ -87,7 +86,7 @@ const drag = (0, import_tool.defineTabTool)({
87
86
  name: "browser_drag",
88
87
  title: "Drag mouse",
89
88
  description: "Perform drag and drop between two elements",
90
- inputSchema: import_schema.baseSchema.extend({
89
+ inputSchema: import_mcpBundle.z.object({
91
90
  startElement: import_mcpBundle.z.string().describe("Human-readable source element description used to obtain the permission to interact with the element"),
92
91
  startRef: import_mcpBundle.z.string().describe("Exact source element reference from the page snapshot"),
93
92
  endElement: import_mcpBundle.z.string().describe("Human-readable target element description used to obtain the permission to interact with the element"),
@@ -24,14 +24,13 @@ module.exports = __toCommonJS(tabs_exports);
24
24
  var import_mcpBundle = require("../../../mcpBundle");
25
25
  var import_tool = require("./tool");
26
26
  var import_response = require("../response");
27
- var import_schema = require("./schema");
28
27
  const browserTabs = (0, import_tool.defineTool)({
29
28
  capability: "core-tabs",
30
29
  schema: {
31
30
  name: "browser_tabs",
32
31
  title: "Manage tabs",
33
32
  description: "List, create, close, or select a browser tab.",
34
- inputSchema: import_schema.baseSchema.extend({
33
+ inputSchema: import_mcpBundle.z.object({
35
34
  action: import_mcpBundle.z.enum(["list", "new", "close", "select"]).describe("Operation to perform"),
36
35
  index: import_mcpBundle.z.number().optional().describe("Tab index, used for close/select. If omitted for close, current tab is closed.")
37
36
  }),
@@ -24,14 +24,13 @@ module.exports = __toCommonJS(verify_exports);
24
24
  var import_mcpBundle = require("../../../mcpBundle");
25
25
  var import_utils = require("playwright-core/lib/utils");
26
26
  var import_tool = require("./tool");
27
- var import_schema = require("./schema");
28
27
  const verifyElement = (0, import_tool.defineTabTool)({
29
28
  capability: "testing",
30
29
  schema: {
31
30
  name: "browser_verify_element_visible",
32
31
  title: "Verify element visible",
33
32
  description: "Verify element is visible on the page",
34
- inputSchema: import_schema.baseSchema.extend({
33
+ inputSchema: import_mcpBundle.z.object({
35
34
  role: import_mcpBundle.z.string().describe('ROLE of the element. Can be found in the snapshot like this: `- {ROLE} "Accessible Name":`'),
36
35
  accessibleName: import_mcpBundle.z.string().describe('ACCESSIBLE_NAME of the element. Can be found in the snapshot like this: `- role "{ACCESSIBLE_NAME}"`')
37
36
  }),
@@ -53,7 +52,7 @@ const verifyText = (0, import_tool.defineTabTool)({
53
52
  name: "browser_verify_text_visible",
54
53
  title: "Verify text visible",
55
54
  description: `Verify text is visible on the page. Prefer ${verifyElement.schema.name} if possible.`,
56
- inputSchema: import_schema.baseSchema.extend({
55
+ inputSchema: import_mcpBundle.z.object({
57
56
  text: import_mcpBundle.z.string().describe('TEXT to verify. Can be found in the snapshot like this: `- role "Accessible Name": {TEXT}` or like this: `- text: {TEXT}`')
58
57
  }),
59
58
  type: "assertion"
@@ -74,7 +73,7 @@ const verifyList = (0, import_tool.defineTabTool)({
74
73
  name: "browser_verify_list_visible",
75
74
  title: "Verify list visible",
76
75
  description: "Verify list is visible on the page",
77
- inputSchema: import_schema.baseSchema.extend({
76
+ inputSchema: import_mcpBundle.z.object({
78
77
  element: import_mcpBundle.z.string().describe("Human-readable list description"),
79
78
  ref: import_mcpBundle.z.string().describe("Exact target element reference that points to the list"),
80
79
  items: import_mcpBundle.z.array(import_mcpBundle.z.string()).describe("Items to verify")
@@ -106,7 +105,7 @@ const verifyValue = (0, import_tool.defineTabTool)({
106
105
  name: "browser_verify_value",
107
106
  title: "Verify value",
108
107
  description: "Verify element value",
109
- inputSchema: import_schema.baseSchema.extend({
108
+ inputSchema: import_mcpBundle.z.object({
110
109
  type: import_mcpBundle.z.enum(["textbox", "checkbox", "radio", "combobox", "slider"]).describe("Type of the element"),
111
110
  element: import_mcpBundle.z.string().describe("Human-readable element description"),
112
111
  ref: import_mcpBundle.z.string().describe("Exact target element reference that points to the element"),
@@ -23,14 +23,13 @@ __export(wait_exports, {
23
23
  module.exports = __toCommonJS(wait_exports);
24
24
  var import_mcpBundle = require("../../../mcpBundle");
25
25
  var import_tool = require("./tool");
26
- var import_schema = require("./schema");
27
26
  const wait = (0, import_tool.defineTool)({
28
27
  capability: "core",
29
28
  schema: {
30
29
  name: "browser_wait_for",
31
30
  title: "Wait for",
32
31
  description: "Wait for text to appear or disappear or a specified time to pass",
33
- inputSchema: import_schema.baseSchema.extend({
32
+ inputSchema: import_mcpBundle.z.object({
34
33
  time: import_mcpBundle.z.number().optional().describe("The time to wait in seconds"),
35
34
  text: import_mcpBundle.z.string().optional().describe("The text to wait for"),
36
35
  textGone: import_mcpBundle.z.string().optional().describe("The text to wait for to disappear")
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cotestdev/mcp_playwright",
3
- "version": "0.0.57",
3
+ "version": "0.0.58",
4
4
  "description": "Playwright MCP (Model Context Protocol) tools for browser automation",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",