Chore: change 'when askes' to more proactive phrasing

This commit is contained in:
Grail Finder
2026-03-03 09:37:34 +03:00
parent 93ecfc8a34
commit 6c9a1ba56b
2 changed files with 19 additions and 25 deletions

View File

@@ -77,17 +77,17 @@ Your current tools:
{ {
"name":"file_create", "name":"file_create",
"args": ["path", "content"], "args": ["path", "content"],
"when_to_use": "when asked to create a new file with optional content" "when_to_use": "when there is a need to create a new file with optional content"
}, },
{ {
"name":"file_read", "name":"file_read",
"args": ["path"], "args": ["path"],
"when_to_use": "when asked to read the content of a file" "when_to_use": "when you need to read the content of a file"
}, },
{ {
"name":"file_read_image", "name":"file_read_image",
"args": ["path"], "args": ["path"],
"when_to_use": "when asked to read or view an image file" "when_to_use": "when you need to read or view an image file"
}, },
{ {
"name":"file_write", "name":"file_write",
@@ -97,7 +97,7 @@ Your current tools:
{ {
"name":"file_write_append", "name":"file_write_append",
"args": ["path", "content"], "args": ["path", "content"],
"when_to_use": "when asked to append content to a file; use sed to edit content" "when_to_use": "when you need append content to a file; use sed to edit content"
}, },
{ {
"name":"file_edit", "name":"file_edit",
@@ -112,22 +112,22 @@ Your current tools:
{ {
"name":"file_move", "name":"file_move",
"args": ["src", "dst"], "args": ["src", "dst"],
"when_to_use": "when asked to move a file from source to destination" "when_to_use": "when you need to move a file from source to destination"
}, },
{ {
"name":"file_copy", "name":"file_copy",
"args": ["src", "dst"], "args": ["src", "dst"],
"when_to_use": "when asked to copy a file from source to destination" "when_to_use": "copy a file from source to destination"
}, },
{ {
"name":"file_list", "name":"file_list",
"args": ["path"], "args": ["path"],
"when_to_use": "when asked to list files in a directory; path is optional (default: current directory)" "when_to_use": "list files in a directory; path is optional (default: current directory)"
}, },
{ {
"name":"execute_command", "name":"execute_command",
"args": ["command", "args"], "args": ["command", "args"],
"when_to_use": "when asked to execute a system command; args is optional; allowed commands: grep, sed, awk, find, cat, head, tail, sort, uniq, wc, ls, echo, cut, tr, cp, mv, rm, mkdir, rmdir, pwd, df, free, ps, top, du, whoami, date, uname, go" "when_to_use": "execute a system command; args is optional; allowed commands: grep, sed, awk, find, cat, head, tail, sort, uniq, wc, ls, echo, cut, tr, cp, mv, rm, mkdir, rmdir, pwd, df, free, ps, top, du, whoami, date, uname, go"
} }
] ]
</tools> </tools>

View File

@@ -33,52 +33,52 @@ Additional browser automation tools (Playwright):
{ {
"name": "pw_navigate", "name": "pw_navigate",
"args": ["url"], "args": ["url"],
"when_to_use": "when asked to open a specific URL in a web browser." "when_to_use": "open a specific URL in the web browser."
}, },
{ {
"name": "pw_click", "name": "pw_click",
"args": ["selector", "index"], "args": ["selector", "index"],
"when_to_use": "when asked to click on an element on the current webpage. 'index' is optional (default 0) to handle multiple matches." "when_to_use": "click on an element on the current webpage. Use 'index' for multiple matches (default 0)."
}, },
{ {
"name": "pw_fill", "name": "pw_fill",
"args": ["selector", "text", "index"], "args": ["selector", "text", "index"],
"when_to_use": "when asked to type text into an input field. 'index' is optional." "when_to_use": "type text into an input field. Use 'index' for multiple matches (default 0)."
}, },
{ {
"name": "pw_extract_text", "name": "pw_extract_text",
"args": ["selector"], "args": ["selector"],
"when_to_use": "when asked to get text content from the page or specific elements. Use selector 'body' for all page text." "when_to_use": "extract text content from the page or specific elements. Use selector 'body' for all page text."
}, },
{ {
"name": "pw_screenshot", "name": "pw_screenshot",
"args": ["selector", "full_page"], "args": ["selector", "full_page"],
"when_to_use": "when asked to take a screenshot of the page or a specific element. Returns a file path to the image." "when_to_use": "take a screenshot of the page or a specific element. Returns a file path to the image. Use to verify actions or inspect visual state."
}, },
{ {
"name": "pw_screenshot_and_view", "name": "pw_screenshot_and_view",
"args": ["selector", "full_page"], "args": ["selector", "full_page"],
"when_to_use": "when asked to take a screenshot and show it to the model. Returns image for viewing." "when_to_use": "take a screenshot and return the image for viewing. Use to visually verify page state."
}, },
{ {
"name": "pw_wait_for_selector", "name": "pw_wait_for_selector",
"args": ["selector", "timeout"], "args": ["selector", "timeout"],
"when_to_use": "when asked to wait for an element to appear on the page before proceeding." "when_to_use": "wait for an element to appear on the page before proceeding with further actions."
}, },
{ {
"name": "pw_drag", "name": "pw_drag",
"args": ["x1", "y1", "x2", "y2"], "args": ["x1", "y1", "x2", "y2"],
"when_to_use": "drag the mouse from point (x1,y1) to (x2,y2)" "when_to_use": "drag the mouse from point (x1,y1) to (x2,y2)."
}, },
{ {
"name": "pw_get_html", "name": "pw_get_html",
"args": ["selector"], "args": ["selector"],
"when_to_use": "get the HTML content of the page or a specific element. Use when you need to understand page structure or extract HTML." "when_to_use": "get the HTML content of the page or a specific element. Use to understand page structure or extract raw HTML."
}, },
{ {
"name": "pw_get_dom", "name": "pw_get_dom",
"args": ["selector"], "args": ["selector"],
"when_to_use": "get a structured DOM representation with tag, attributes, text, and children. Use when you need a readable tree view of page elements." "when_to_use": "get a structured DOM representation with tag, attributes, text, and children. Use to inspect element hierarchy and properties."
}, },
{ {
"name": "pw_search_elements", "name": "pw_search_elements",
@@ -493,12 +493,10 @@ func buildDOMTree(locator playwright.Locator) ([]DOMElement, error) {
func elementToDOM(el playwright.Locator) (DOMElement, error) { func elementToDOM(el playwright.Locator) (DOMElement, error) {
dom := DOMElement{} dom := DOMElement{}
tag, err := el.Evaluate(`el => el.nodeName`, nil) tag, err := el.Evaluate(`el => el.nodeName`, nil)
if err == nil { if err == nil {
dom.Tag = strings.ToLower(fmt.Sprintf("%v", tag)) dom.Tag = strings.ToLower(fmt.Sprintf("%v", tag))
} }
attributes := make(map[string]string) attributes := make(map[string]string)
attrs, err := el.Evaluate(`el => { attrs, err := el.Evaluate(`el => {
let attrs = {}; let attrs = {};
@@ -520,17 +518,14 @@ func elementToDOM(el playwright.Locator) (DOMElement, error) {
if len(attributes) > 0 { if len(attributes) > 0 {
dom.Attributes = attributes dom.Attributes = attributes
} }
text, err := el.TextContent() text, err := el.TextContent()
if err == nil && text != "" { if err == nil && text != "" {
dom.Text = text dom.Text = text
} }
innerHTML, err := el.InnerHTML() innerHTML, err := el.InnerHTML()
if err == nil && innerHTML != "" { if err == nil && innerHTML != "" {
dom.InnerHTML = innerHTML dom.InnerHTML = innerHTML
} }
childCount, _ := el.Count() childCount, _ := el.Count()
if childCount > 0 { if childCount > 0 {
childrenLocator := el.Locator("*") childrenLocator := el.Locator("*")
@@ -539,7 +534,6 @@ func elementToDOM(el playwright.Locator) (DOMElement, error) {
dom.Children = children dom.Children = children
} }
} }
return dom, nil return dom, nil
} }
@@ -599,7 +593,7 @@ func pwSearchElements(args map[string]string) []byte {
text, _ := el.TextContent() text, _ := el.TextContent()
html, _ := el.InnerHTML() html, _ := el.InnerHTML()
results = append(results, map[string]string{ results = append(results, map[string]string{
"index": fmt.Sprintf("%d", i), "index": strconv.Itoa(i),
"tag": strings.ToLower(fmt.Sprintf("%v", tag)), "tag": strings.ToLower(fmt.Sprintf("%v", tag)),
"text": text, "text": text,
"html": html, "html": html,