@mcp-browser-kit/server 1.0.3 → 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
@@ -9495,8 +9495,7 @@ server.tool(
9495
9495
  "getReadableElements",
9496
9496
  [
9497
9497
  combinationDescription,
9498
- "# Description",
9499
- "- 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",
9500
9499
  "- Usually being called after `getTabs` to read or identify element to interact with."
9501
9500
  ].join("\n"),
9502
9501
  {
@@ -9515,20 +9514,19 @@ server.tool(
9515
9514
  }
9516
9515
  );
9517
9516
  server.tool(
9518
- "clickReadableElementAtIndex",
9517
+ "fillTextToIndex",
9519
9518
  [
9520
9519
  combinationDescription,
9521
- "# Description",
9522
- "- This tool clicks on an element with a given index.",
9523
- "- Usually being called after `getReadableElements` to interact with the element.",
9524
- "- 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"
9525
9522
  ].join("\n"),
9526
9523
  {
9527
9524
  tabId: z.string().describe("Tab ID to evaluate the code in"),
9528
- 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")
9529
9527
  },
9530
- async ({ tabId, index }) => {
9531
- await rpcClient.defer("clickReadableElementAtIndex", tabId, index);
9528
+ async ({ tabId, index, value }) => {
9529
+ await rpcClient.defer("fillTextToIndex", tabId, index, value);
9532
9530
  return {
9533
9531
  content: [
9534
9532
  {
@@ -9540,20 +9538,20 @@ server.tool(
9540
9538
  }
9541
9539
  );
9542
9540
  server.tool(
9543
- "setValueToReadableElementAtIndex",
9541
+ "clickOnIndex",
9544
9542
  [
9545
9543
  combinationDescription,
9546
- "# Description",
9547
- "This tool sets the value of an element with a given index.",
9548
- "- 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."
9549
9548
  ].join("\n"),
9550
9549
  {
9551
9550
  tabId: z.string().describe("Tab ID to evaluate the code in"),
9552
- index: z.number().describe("Index of the element to set value"),
9553
- value: z.string().describe("Value to set")
9551
+ index: z.number().describe("Index of the element to click")
9554
9552
  },
9555
- async ({ tabId, index, value }) => {
9556
- await rpcClient.defer("setValueToReadableElementAtIndex", tabId, index, value);
9553
+ async ({ tabId, index }) => {
9554
+ await rpcClient.defer("clickOnIndex", tabId, index);
9557
9555
  return {
9558
9556
  content: [
9559
9557
  {
@@ -9569,16 +9567,21 @@ server.tool(
9569
9567
  [
9570
9568
  combinationDescription,
9571
9569
  "# Description",
9572
- "This tool evaluates JavaScript code in the context of a given tab.",
9573
- "- Usually being called after `getReadableElements` to interact with the element.",
9574
- "- 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."
9575
9573
  ].join("\n"),
9576
9574
  {
9577
9575
  tabId: z.string().describe("Tab ID to evaluate the code in"),
9578
- fnCode: z.string().describe("JavaScript function to be invoked")
9576
+ fnBodyCode: z.string().describe("A JavaScript function body to evaluate")
9579
9577
  },
9580
- async ({ tabId, index, fnCode }) => {
9581
- 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
+ );
9582
9585
  return {
9583
9586
  content: [
9584
9587
  {