summaryrefslogtreecommitdiff
path: root/tools.go
diff options
context:
space:
mode:
authorGrail Finder <wohilas@gmail.com>2026-03-03 09:27:05 +0300
committerGrail Finder <wohilas@gmail.com>2026-03-03 09:27:05 +0300
commit93ecfc8a347471a16d21a5bd9f1cfc99fe39a538 (patch)
tree974730544efce2a09ad1c9ab9a5ffd518810c1ab /tools.go
parent0c9c590d8f9c49578515ccaf19bb11431cf4e721 (diff)
Enha: palywright dom and elements fetching
Diffstat (limited to 'tools.go')
-rw-r--r--tools.go58
1 files changed, 58 insertions, 0 deletions
diff --git a/tools.go b/tools.go
index 87956ef..5683a90 100644
--- a/tools.go
+++ b/tools.go
@@ -1493,6 +1493,9 @@ func registerPlaywrightTools() {
fnMap["pw_screenshot_and_view"] = pwScreenshotAndView
fnMap["pw_wait_for_selector"] = pwWaitForSelector
fnMap["pw_drag"] = pwDrag
+ fnMap["pw_get_html"] = pwGetHTML
+ fnMap["pw_get_dom"] = pwGetDOM
+ fnMap["pw_search_elements"] = pwSearchElements
playwrightTools := []models.Tool{
{
Type: "function",
@@ -1702,6 +1705,61 @@ func registerPlaywrightTools() {
},
},
},
+ {
+ Type: "function",
+ Function: models.ToolFunc{
+ Name: "pw_get_html",
+ Description: "Get the HTML content of the page or a specific element.",
+ Parameters: models.ToolFuncParams{
+ Type: "object",
+ Required: []string{},
+ Properties: map[string]models.ToolArgProps{
+ "selector": models.ToolArgProps{
+ Type: "string",
+ Description: "optional CSS selector (default: body)",
+ },
+ },
+ },
+ },
+ },
+ {
+ Type: "function",
+ Function: models.ToolFunc{
+ Name: "pw_get_dom",
+ Description: "Get a structured DOM representation of an element with tag, attributes, text, and children.",
+ Parameters: models.ToolFuncParams{
+ Type: "object",
+ Required: []string{},
+ Properties: map[string]models.ToolArgProps{
+ "selector": models.ToolArgProps{
+ Type: "string",
+ Description: "optional CSS selector (default: body)",
+ },
+ },
+ },
+ },
+ },
+ {
+ Type: "function",
+ Function: models.ToolFunc{
+ Name: "pw_search_elements",
+ Description: "Search for elements by text content or CSS selector. Returns matching elements with their tags, text, and HTML.",
+ Parameters: models.ToolFuncParams{
+ Type: "object",
+ Required: []string{},
+ Properties: map[string]models.ToolArgProps{
+ "text": models.ToolArgProps{
+ Type: "string",
+ Description: "text to search for in elements",
+ },
+ "selector": models.ToolArgProps{
+ Type: "string",
+ Description: "CSS selector to search for",
+ },
+ },
+ },
+ },
+ },
}
baseTools = append(baseTools, playwrightTools...)
toolSysMsg += browserToolSysMsg