@mcp-browser-kit/server 1.0.2 → 1.0.6

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/main.js CHANGED
@@ -1,3 +1,5 @@
1
+ #!/usr/bin/env node
2
+
1
3
  // ../../node_modules/@trpc/server/dist/unstable-core-do-not-import/createProxy.mjs
2
4
  var noop = () => {
3
5
  };
@@ -9493,8 +9495,7 @@ server.tool(
9493
9495
  "getReadableElements",
9494
9496
  [
9495
9497
  combinationDescription,
9496
- "# Description",
9497
- "- This tool returns a list of [tag,accessible-text] pairs of elements",
9498
+ "- Use this tool to get a list of [tag,accessible-text] pairs",
9498
9499
  "- Usually being called after `getTabs` to read or identify element to interact with."
9499
9500
  ].join("\n"),
9500
9501
  {
@@ -9513,20 +9514,19 @@ server.tool(
9513
9514
  }
9514
9515
  );
9515
9516
  server.tool(
9516
- "clickReadableElementAtIndex",
9517
+ "fillTextToIndex",
9517
9518
  [
9518
9519
  combinationDescription,
9519
- "# Description",
9520
- "- This tool clicks on an element with a given index.",
9521
- "- Usually being called after `getReadableElements` to interact with the element.",
9522
- "- Can be called after `setValueToReadableElementAtIndex` to perform a submit action."
9520
+ "- Use this tool to set value to the ReadableElement at the specified index.",
9521
+ "- For tasks requiring user input (text, numbers, passwords, etc.), such as fill form before submit, fill text before search, fill username & password before login"
9523
9522
  ].join("\n"),
9524
9523
  {
9525
9524
  tabId: z.string().describe("Tab ID to evaluate the code in"),
9526
- index: z.number().describe("Index of the element to click")
9525
+ index: z.number().describe("Index of the element to set value"),
9526
+ value: z.string().describe("Value to set")
9527
9527
  },
9528
- async ({ tabId, index }) => {
9529
- await rpcClient.defer("clickReadableElementAtIndex", tabId, index);
9528
+ async ({ tabId, index, value }) => {
9529
+ await rpcClient.defer("fillTextToIndex", tabId, index, value);
9530
9530
  return {
9531
9531
  content: [
9532
9532
  {
@@ -9538,20 +9538,20 @@ server.tool(
9538
9538
  }
9539
9539
  );
9540
9540
  server.tool(
9541
- "setValueToReadableElementAtIndex",
9541
+ "clickOnIndex",
9542
9542
  [
9543
9543
  combinationDescription,
9544
- "# Description",
9545
- "This tool sets the value of an element with a given index.",
9546
- "- Usually being called after `getReadableElements` to interact with the element."
9544
+ "- Use this tool to click on ReadableElement at the specified index.",
9545
+ "- For tasks that involve clicking, like buttons, links, etc.",
9546
+ "- Usually being called after `getReadableElements` to interact with the element.",
9547
+ "- If the task potentially requires filling inputs, use `fillTextToIndex` first."
9547
9548
  ].join("\n"),
9548
9549
  {
9549
9550
  tabId: z.string().describe("Tab ID to evaluate the code in"),
9550
- index: z.number().describe("Index of the element to set value"),
9551
- value: z.string().describe("Value to set")
9551
+ index: z.number().describe("Index of the element to click")
9552
9552
  },
9553
- async ({ tabId, index, value }) => {
9554
- await rpcClient.defer("setValueToReadableElementAtIndex", tabId, index, value);
9553
+ async ({ tabId, index }) => {
9554
+ await rpcClient.defer("clickOnIndex", tabId, index);
9555
9555
  return {
9556
9556
  content: [
9557
9557
  {
@@ -9567,16 +9567,21 @@ server.tool(
9567
9567
  [
9568
9568
  combinationDescription,
9569
9569
  "# Description",
9570
- "This tool evaluates JavaScript code in the context of a given tab.",
9571
- "- Usually being called after `getReadableElements` to interact with the element.",
9572
- "- Use this tool as the last resort to interact with the element."
9570
+ "- Use this tool only if action cannot be performed via series of clicks and types.",
9571
+ "- Use this tool to evaluate a JavaScript function body in the context of the page.",
9572
+ "- Usually being called after `getReadableElements` to interact with the element."
9573
9573
  ].join("\n"),
9574
9574
  {
9575
9575
  tabId: z.string().describe("Tab ID to evaluate the code in"),
9576
- fnCode: z.string().describe("JavaScript function to be invoked")
9576
+ fnBodyCode: z.string().describe("A JavaScript function body to evaluate")
9577
9577
  },
9578
- async ({ tabId, index, fnCode }) => {
9579
- const result = await rpcClient.defer("invokeJsFn", tabId, index, fnCode);
9578
+ async ({ tabId, index, fnBodyCode }) => {
9579
+ const result = await rpcClient.defer(
9580
+ "invokeJsFn",
9581
+ tabId,
9582
+ index,
9583
+ fnBodyCode
9584
+ );
9580
9585
  return {
9581
9586
  content: [
9582
9587
  {