From cad1bd46c191f811729ab1cd5f044931c7d10269 Mon Sep 17 00:00:00 2001 From: Grail Finder Date: Mon, 2 Mar 2026 19:20:54 +0300 Subject: Feat: playwright tools --- tools_playwright.go | 62 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 tools_playwright.go (limited to 'tools_playwright.go') diff --git a/tools_playwright.go b/tools_playwright.go new file mode 100644 index 0000000..e8b3db5 --- /dev/null +++ b/tools_playwright.go @@ -0,0 +1,62 @@ +package main + +var browserToolSysMsg = ` +Additional browser automation tools (Playwright): +[ +{ + "name": "pw_start", + "args": [], + "when_to_use": "start a browser instance before doing any browser automation. Must be called first." +}, +{ + "name": "pw_stop", + "args": [], + "when_to_use": "stop the browser instance when done with automation." +}, +{ + "name": "pw_is_running", + "args": [], + "when_to_use": "check if browser is currently running." +}, +{ + "name": "pw_navigate", + "args": ["url"], + "when_to_use": "when asked to open a specific URL in a web browser." +}, +{ + "name": "pw_click", + "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." +}, +{ + "name": "pw_fill", + "args": ["selector", "text", "index"], + "when_to_use": "when asked to type text into an input field. 'index' is optional." +}, +{ + "name": "pw_extract_text", + "args": ["selector"], + "when_to_use": "when asked to get text content from the page or specific elements. Use selector 'body' for all page text." +}, +{ + "name": "pw_screenshot", + "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." +}, +{ + "name": "pw_screenshot_and_view", + "args": ["selector", "full_page"], + "when_to_use": "when asked to take a screenshot and show it to the model. Returns image for viewing." +}, +{ + "name": "pw_wait_for_selector", + "args": ["selector", "timeout"], + "when_to_use": "when asked to wait for an element to appear on the page before proceeding." +}, +{ + "name": "pw_drag", + "args": ["x1", "y1", "x2", "y2"], + "when_to_use": "drag the mouse from point (x1,y1) to (x2,y2)" +} +] +` -- cgit v1.2.3