This commit is contained in:
Josh at WLTechBlog
2025-12-31 17:13:17 -07:00
parent f09cdc2973
commit ec391bd7ed
4 changed files with 301 additions and 200 deletions

View File

@@ -173,7 +173,7 @@ func main() {
"timeout": map[string]any{
"type": "integer",
"description": "Timeout in seconds",
"default": 5,
"default": 30,
},
"clear_cache": map[string]any{
"type": "boolean",
@@ -213,7 +213,7 @@ func main() {
}
tab := getStringParam(params, "tab", cremoteServer.currentTab)
timeout := getIntParam(params, "timeout", 5)
timeout := getIntParam(params, "timeout", 30)
clearCache := getBoolParam(params, "clear_cache", false)
takeScreenshot := getBoolParam(params, "screenshot", false)
extractType := getStringParam(params, "extract", "")
@@ -338,7 +338,7 @@ func main() {
"timeout": map[string]any{
"type": "integer",
"description": "Timeout in seconds",
"default": 5,
"default": 30,
},
},
Required: []string{"action", "selector"},
@@ -354,7 +354,7 @@ func main() {
selector := getStringParam(params, "selector", "")
value := getStringParam(params, "value", "")
tab := getStringParam(params, "tab", cremoteServer.currentTab)
timeout := getIntParam(params, "timeout", 5)
timeout := getIntParam(params, "timeout", 30)
if action == "" {
return nil, fmt.Errorf("action parameter is required")
@@ -474,7 +474,7 @@ func main() {
"timeout": map[string]any{
"type": "integer",
"description": "Timeout in seconds",
"default": 5,
"default": 30,
},
},
Required: []string{"type"},
@@ -489,7 +489,7 @@ func main() {
extractType := getStringParam(params, "type", "")
selector := getStringParam(params, "selector", "")
code := getStringParam(params, "code", "")
timeout := getIntParam(params, "timeout", 5)
timeout := getIntParam(params, "timeout", 30)
if extractType == "" {
return nil, fmt.Errorf("type parameter is required")
@@ -574,7 +574,7 @@ func main() {
"timeout": map[string]any{
"type": "integer",
"description": "Timeout in seconds",
"default": 5,
"default": 30,
},
},
Required: []string{"output"},
@@ -589,7 +589,7 @@ func main() {
output := getStringParam(params, "output", "")
fullPage := getBoolParam(params, "full_page", false)
tab := getStringParam(params, "tab", cremoteServer.currentTab)
timeout := getIntParam(params, "timeout", 5)
timeout := getIntParam(params, "timeout", 30)
// Get optional zoom and viewport parameters
var zoomLevel float64
@@ -697,7 +697,7 @@ func main() {
"timeout": map[string]any{
"type": "integer",
"description": "Timeout in seconds",
"default": 5,
"default": 30,
},
},
Required: []string{"action"},
@@ -711,7 +711,7 @@ func main() {
action := getStringParam(params, "action", "")
tab := getStringParam(params, "tab", "")
timeout := getIntParam(params, "timeout", 5)
timeout := getIntParam(params, "timeout", 30)
if action == "" {
return nil, fmt.Errorf("action parameter is required")
@@ -814,7 +814,7 @@ func main() {
"timeout": map[string]any{
"type": "integer",
"description": "Timeout in seconds",
"default": 5,
"default": 30,
},
},
Required: []string{"action"},
@@ -829,7 +829,7 @@ func main() {
action := getStringParam(params, "action", "")
selector := getStringParam(params, "selector", "")
tab := getStringParam(params, "tab", cremoteServer.currentTab)
timeout := getIntParam(params, "timeout", 5)
timeout := getIntParam(params, "timeout", 30)
if action == "" {
return nil, fmt.Errorf("action parameter is required")
@@ -1044,8 +1044,8 @@ func main() {
},
"timeout": map[string]any{
"type": "integer",
"description": "Timeout in seconds (default: 5)",
"default": 5,
"description": "Timeout in seconds (default: 30)",
"default": 30,
},
},
Required: []string{"command"},
@@ -1060,7 +1060,7 @@ func main() {
command := getStringParam(params, "command", "")
tab := getStringParam(params, "tab", cremoteServer.currentTab)
injectLibrary := getStringParam(params, "inject_library", "")
timeout := getIntParam(params, "timeout", 5)
timeout := getIntParam(params, "timeout", 30)
if command == "" {
return nil, fmt.Errorf("command parameter is required")
@@ -1143,7 +1143,7 @@ func main() {
"timeout": map[string]any{
"type": "integer",
"description": "Timeout in seconds",
"default": 5,
"default": 30,
},
},
Required: []string{"selector"},
@@ -1157,7 +1157,7 @@ func main() {
selector := getStringParam(params, "selector", "")
checkType := getStringParam(params, "check_type", "exists")
timeout := getIntParam(params, "timeout", 5)
timeout := getIntParam(params, "timeout", 30)
if selector == "" {
return nil, fmt.Errorf("selector parameter is required")
@@ -1221,7 +1221,7 @@ func main() {
"timeout": map[string]any{
"type": "integer",
"description": "Timeout in seconds",
"default": 5,
"default": 30,
},
},
Required: []string{"selector"},
@@ -1235,7 +1235,7 @@ func main() {
selector := getStringParam(params, "selector", "")
attributes := getStringParam(params, "attributes", "all")
timeout := getIntParam(params, "timeout", 5)
timeout := getIntParam(params, "timeout", 30)
if selector == "" {
return nil, fmt.Errorf("selector parameter is required")
@@ -1285,7 +1285,7 @@ func main() {
"timeout": map[string]any{
"type": "integer",
"description": "Timeout in seconds",
"default": 5,
"default": 30,
},
},
Required: []string{"selectors"},
@@ -1299,7 +1299,7 @@ func main() {
selectorsParam := params["selectors"]
tab := getStringParam(params, "tab", cremoteServer.currentTab)
timeout := getIntParam(params, "timeout", 5)
timeout := getIntParam(params, "timeout", 30)
if selectorsParam == nil {
return nil, fmt.Errorf("selectors parameter is required")
@@ -1362,7 +1362,7 @@ func main() {
"timeout": map[string]any{
"type": "integer",
"description": "Timeout in seconds",
"default": 5,
"default": 30,
},
},
Required: []string{},
@@ -1378,7 +1378,7 @@ func main() {
hrefPattern := getStringParam(params, "href_pattern", "")
textPattern := getStringParam(params, "text_pattern", "")
tab := getStringParam(params, "tab", cremoteServer.currentTab)
timeout := getIntParam(params, "timeout", 5)
timeout := getIntParam(params, "timeout", 30)
if tab == "" {
return nil, fmt.Errorf("no tab available - navigate to a page first")
@@ -1423,7 +1423,7 @@ func main() {
"timeout": map[string]any{
"type": "integer",
"description": "Timeout in seconds",
"default": 5,
"default": 30,
},
},
Required: []string{"selector"},
@@ -1438,7 +1438,7 @@ func main() {
selector := getStringParam(params, "selector", "")
includeHeaders := getBoolParam(params, "include_headers", true)
tab := getStringParam(params, "tab", cremoteServer.currentTab)
timeout := getIntParam(params, "timeout", 5)
timeout := getIntParam(params, "timeout", 30)
if selector == "" {
return nil, fmt.Errorf("selector parameter is required")
@@ -1491,7 +1491,7 @@ func main() {
"timeout": map[string]any{
"type": "integer",
"description": "Timeout in seconds",
"default": 5,
"default": 30,
},
},
Required: []string{"selector"},
@@ -1507,7 +1507,7 @@ func main() {
pattern := getStringParam(params, "pattern", "")
extractType := getStringParam(params, "extract_type", "textContent")
tab := getStringParam(params, "tab", cremoteServer.currentTab)
timeout := getIntParam(params, "timeout", 5)
timeout := getIntParam(params, "timeout", 30)
if selector == "" {
return nil, fmt.Errorf("selector parameter is required")
@@ -1550,7 +1550,7 @@ func main() {
"timeout": map[string]any{
"type": "integer",
"description": "Timeout in seconds",
"default": 5,
"default": 30,
},
},
Required: []string{"selector"},
@@ -1568,7 +1568,7 @@ func main() {
}
tab := getStringParam(params, "tab", cremoteServer.currentTab)
timeout := getIntParam(params, "timeout", 5)
timeout := getIntParam(params, "timeout", 30)
result, err := cremoteServer.client.AnalyzeForm(tab, selector, timeout)
if err != nil {
@@ -1625,7 +1625,7 @@ func main() {
"timeout": map[string]any{
"type": "integer",
"description": "Timeout in seconds",
"default": 5,
"default": 30,
},
},
Required: []string{"interactions"},
@@ -1672,7 +1672,7 @@ func main() {
}
tab := getStringParam(params, "tab", cremoteServer.currentTab)
timeout := getIntParam(params, "timeout", 5)
timeout := getIntParam(params, "timeout", 30)
result, err := cremoteServer.client.InteractMultiple(tab, interactions, timeout)
if err != nil {
@@ -1714,7 +1714,7 @@ func main() {
"timeout": map[string]any{
"type": "integer",
"description": "Timeout in seconds",
"default": 5,
"default": 30,
},
},
Required: []string{"fields"},
@@ -1743,7 +1743,7 @@ func main() {
formSelector := getStringParam(params, "form_selector", "")
tab := getStringParam(params, "tab", cremoteServer.currentTab)
timeout := getIntParam(params, "timeout", 5)
timeout := getIntParam(params, "timeout", 30)
result, err := cremoteServer.client.FillFormBulk(tab, formSelector, fields, timeout)
if err != nil {
@@ -1785,8 +1785,8 @@ func main() {
},
"timeout": map[string]any{
"type": "integer",
"description": "Timeout in seconds (default: 5)",
"default": 5,
"description": "Timeout in seconds (default: 30)",
"default": 30,
},
},
},
@@ -1797,7 +1797,7 @@ func main() {
return nil, fmt.Errorf("invalid arguments format")
}
timeout := getIntParam(params, "timeout", 5)
timeout := getIntParam(params, "timeout", 30)
// Handle optional navigation and cache clearing
tabID, err := handleOptionalNavigation(cremoteServer, params, timeout)
@@ -1841,8 +1841,8 @@ func main() {
},
"timeout": map[string]any{
"type": "integer",
"description": "Timeout in seconds (default: 5)",
"default": 5,
"description": "Timeout in seconds (default: 30)",
"default": 30,
},
},
},
@@ -1854,7 +1854,7 @@ func main() {
}
tabID := getStringParam(params, "tab", "")
timeout := getIntParam(params, "timeout", 5)
timeout := getIntParam(params, "timeout", 30)
result, err := cremoteServer.client.GetViewportInfo(tabID, timeout)
if err != nil {
@@ -1892,8 +1892,8 @@ func main() {
},
"timeout": map[string]any{
"type": "integer",
"description": "Timeout in seconds (default: 5)",
"default": 5,
"description": "Timeout in seconds (default: 30)",
"default": 30,
},
},
},
@@ -1905,7 +1905,7 @@ func main() {
}
tabID := getStringParam(params, "tab", "")
timeout := getIntParam(params, "timeout", 5)
timeout := getIntParam(params, "timeout", 30)
result, err := cremoteServer.client.GetPerformance(tabID, timeout)
if err != nil {
@@ -1948,8 +1948,8 @@ func main() {
},
"timeout": map[string]any{
"type": "integer",
"description": "Timeout in seconds (default: 5)",
"default": 5,
"description": "Timeout in seconds (default: 30)",
"default": 30,
},
},
Required: []string{"type"},
@@ -1967,7 +1967,7 @@ func main() {
}
tabID := getStringParam(params, "tab", "")
timeout := getIntParam(params, "timeout", 5)
timeout := getIntParam(params, "timeout", 30)
result, err := cremoteServer.client.CheckContent(tabID, contentType, timeout)
if err != nil {
@@ -2015,7 +2015,7 @@ func main() {
},
"timeout": map[string]any{
"type": "integer",
"description": "Timeout in seconds (default: 5)",
"description": "Timeout in seconds (default: 30)",
},
},
Required: []string{"selector", "output"},
@@ -2030,7 +2030,7 @@ func main() {
selector := getStringParam(params, "selector", "")
output := getStringParam(params, "output", "")
tab := getStringParam(params, "tab", cremoteServer.currentTab)
timeout := getIntParam(params, "timeout", 5)
timeout := getIntParam(params, "timeout", 30)
if selector == "" {
return nil, fmt.Errorf("selector parameter is required")
@@ -2109,7 +2109,7 @@ func main() {
},
"timeout": map[string]any{
"type": "integer",
"description": "Timeout in seconds (default: 5)",
"description": "Timeout in seconds (default: 30)",
},
},
Required: []string{"output"},
@@ -2124,7 +2124,7 @@ func main() {
output := getStringParam(params, "output", "")
fullPage := getBoolParam(params, "full_page", false)
tab := getStringParam(params, "tab", cremoteServer.currentTab)
timeout := getIntParam(params, "timeout", 5)
timeout := getIntParam(params, "timeout", 30)
if output == "" {
return nil, fmt.Errorf("output parameter is required")
@@ -2380,7 +2380,7 @@ func main() {
"timeout": map[string]any{
"type": "integer",
"description": "Timeout in seconds",
"default": 5,
"default": 30,
},
},
Required: []string{},
@@ -2393,7 +2393,7 @@ func main() {
tab := getStringParam(params, "tab", cremoteServer.currentTab)
includeContrast := getBoolParam(params, "include_contrast", false)
timeout := getIntParam(params, "timeout", 5)
timeout := getIntParam(params, "timeout", 30)
// Parse depth parameter
var depth *int
@@ -2465,7 +2465,7 @@ func main() {
"timeout": map[string]any{
"type": "integer",
"description": "Timeout in seconds",
"default": 5,
"default": 30,
},
},
Required: []string{"selector"},
@@ -2482,7 +2482,7 @@ func main() {
}
tab := getStringParam(params, "tab", cremoteServer.currentTab)
timeout := getIntParam(params, "timeout", 5)
timeout := getIntParam(params, "timeout", 30)
fetchRelatives := getBoolParam(params, "fetch_relatives", true)
result, err := cremoteServer.client.GetPartialAccessibilityTree(tab, selector, fetchRelatives, timeout)
@@ -2528,7 +2528,7 @@ func main() {
"timeout": map[string]any{
"type": "integer",
"description": "Timeout in seconds",
"default": 5,
"default": 30,
},
},
Required: []string{},
@@ -2540,7 +2540,7 @@ func main() {
}
tab := getStringParam(params, "tab", cremoteServer.currentTab)
timeout := getIntParam(params, "timeout", 5)
timeout := getIntParam(params, "timeout", 30)
selector := getStringParam(params, "selector", "")
accessibleName := getStringParam(params, "accessible_name", "")
role := getStringParam(params, "role", "")
@@ -2581,8 +2581,8 @@ func main() {
},
"timeout": map[string]any{
"type": "integer",
"description": "Timeout in seconds (default: 5)",
"default": 5,
"description": "Timeout in seconds (default: 30)",
"default": 30,
},
},
},
@@ -2594,7 +2594,7 @@ func main() {
}
tab := getStringParam(params, "tab", "")
timeout := getIntParam(params, "timeout", 5)
timeout := getIntParam(params, "timeout", 30)
err := cremoteServer.client.DisableCache(tab, timeout)
if err != nil {
@@ -2626,8 +2626,8 @@ func main() {
},
"timeout": map[string]any{
"type": "integer",
"description": "Timeout in seconds (default: 5)",
"default": 5,
"description": "Timeout in seconds (default: 30)",
"default": 30,
},
},
},
@@ -2639,7 +2639,7 @@ func main() {
}
tab := getStringParam(params, "tab", "")
timeout := getIntParam(params, "timeout", 5)
timeout := getIntParam(params, "timeout", 30)
err := cremoteServer.client.EnableCache(tab, timeout)
if err != nil {
@@ -2671,8 +2671,8 @@ func main() {
},
"timeout": map[string]any{
"type": "integer",
"description": "Timeout in seconds (default: 5)",
"default": 5,
"description": "Timeout in seconds (default: 30)",
"default": 30,
},
},
},
@@ -2684,7 +2684,7 @@ func main() {
}
tab := getStringParam(params, "tab", "")
timeout := getIntParam(params, "timeout", 5)
timeout := getIntParam(params, "timeout", 30)
err := cremoteServer.client.ClearCache(tab, timeout)
if err != nil {
@@ -2717,8 +2717,8 @@ func main() {
},
"timeout": map[string]any{
"type": "integer",
"description": "Timeout in seconds (default: 5)",
"default": 5,
"description": "Timeout in seconds (default: 30)",
"default": 30,
},
},
},
@@ -2730,7 +2730,7 @@ func main() {
}
tab := getStringParam(params, "tab", "")
timeout := getIntParam(params, "timeout", 5)
timeout := getIntParam(params, "timeout", 30)
err := cremoteServer.client.ClearAllSiteData(tab, timeout)
if err != nil {
@@ -2762,8 +2762,8 @@ func main() {
},
"timeout": map[string]any{
"type": "integer",
"description": "Timeout in seconds (default: 5)",
"default": 5,
"description": "Timeout in seconds (default: 30)",
"default": 30,
},
},
},
@@ -2775,7 +2775,7 @@ func main() {
}
tab := getStringParam(params, "tab", "")
timeout := getIntParam(params, "timeout", 5)
timeout := getIntParam(params, "timeout", 30)
err := cremoteServer.client.ClearCookies(tab, timeout)
if err != nil {
@@ -2807,8 +2807,8 @@ func main() {
},
"timeout": map[string]any{
"type": "integer",
"description": "Timeout in seconds (default: 5)",
"default": 5,
"description": "Timeout in seconds (default: 30)",
"default": 30,
},
},
},
@@ -2820,7 +2820,7 @@ func main() {
}
tab := getStringParam(params, "tab", "")
timeout := getIntParam(params, "timeout", 5)
timeout := getIntParam(params, "timeout", 30)
err := cremoteServer.client.ClearStorage(tab, timeout)
if err != nil {
@@ -2861,8 +2861,8 @@ func main() {
},
"timeout": map[string]any{
"type": "integer",
"description": "Timeout in seconds (default: 5)",
"default": 5,
"description": "Timeout in seconds (default: 30)",
"default": 30,
},
},
Required: []string{"source", "target"},
@@ -2877,7 +2877,7 @@ func main() {
source := getStringParam(params, "source", "")
target := getStringParam(params, "target", "")
tab := getStringParam(params, "tab", "")
timeout := getIntParam(params, "timeout", 5)
timeout := getIntParam(params, "timeout", 30)
if source == "" {
return &mcp.CallToolResult{
@@ -2939,8 +2939,8 @@ func main() {
},
"timeout": map[string]any{
"type": "integer",
"description": "Timeout in seconds (default: 5)",
"default": 5,
"description": "Timeout in seconds (default: 30)",
"default": 30,
},
},
Required: []string{"source", "x", "y"},
@@ -2956,7 +2956,7 @@ func main() {
x := getIntParam(params, "x", 0)
y := getIntParam(params, "y", 0)
tab := getStringParam(params, "tab", "")
timeout := getIntParam(params, "timeout", 5)
timeout := getIntParam(params, "timeout", 30)
if source == "" {
return &mcp.CallToolResult{
@@ -3009,8 +3009,8 @@ func main() {
},
"timeout": map[string]any{
"type": "integer",
"description": "Timeout in seconds (default: 5)",
"default": 5,
"description": "Timeout in seconds (default: 30)",
"default": 30,
},
},
Required: []string{"source", "offset_x", "offset_y"},
@@ -3026,7 +3026,7 @@ func main() {
offsetX := getIntParam(params, "offset_x", 0)
offsetY := getIntParam(params, "offset_y", 0)
tab := getStringParam(params, "tab", "")
timeout := getIntParam(params, "timeout", 5)
timeout := getIntParam(params, "timeout", 30)
if source == "" {
return &mcp.CallToolResult{
@@ -3072,8 +3072,8 @@ func main() {
},
"timeout": map[string]any{
"type": "integer",
"description": "Timeout in seconds (default: 5)",
"default": 5,
"description": "Timeout in seconds (default: 30)",
"default": 30,
},
},
Required: []string{"selector"},
@@ -3138,8 +3138,8 @@ func main() {
},
"timeout": map[string]any{
"type": "integer",
"description": "Timeout in seconds (default: 5)",
"default": 5,
"description": "Timeout in seconds (default: 30)",
"default": 30,
},
},
Required: []string{"selector"},
@@ -3204,8 +3204,8 @@ func main() {
},
"timeout": map[string]any{
"type": "integer",
"description": "Timeout in seconds (default: 5)",
"default": 5,
"description": "Timeout in seconds (default: 30)",
"default": 30,
},
},
Required: []string{"selector"},
@@ -3270,8 +3270,8 @@ func main() {
},
"timeout": map[string]any{
"type": "integer",
"description": "Timeout in seconds (default: 5)",
"default": 5,
"description": "Timeout in seconds (default: 30)",
"default": 30,
},
},
Required: []string{"selector"},
@@ -3340,8 +3340,8 @@ func main() {
},
"timeout": map[string]any{
"type": "integer",
"description": "Timeout in seconds (default: 5)",
"default": 5,
"description": "Timeout in seconds (default: 30)",
"default": 30,
},
},
Required: []string{"x", "y"},
@@ -3426,8 +3426,8 @@ func main() {
},
"timeout": map[string]any{
"type": "integer",
"description": "Timeout in seconds (default: 5)",
"default": 5,
"description": "Timeout in seconds (default: 30)",
"default": 30,
},
},
Required: []string{"x", "y", "delta_y"},
@@ -3513,8 +3513,8 @@ func main() {
},
"timeout": map[string]any{
"type": "integer",
"description": "Timeout in seconds (default: 5)",
"default": 5,
"description": "Timeout in seconds (default: 30)",
"default": 30,
},
},
Required: []string{"keys"},
@@ -3579,8 +3579,8 @@ func main() {
},
"timeout": map[string]any{
"type": "integer",
"description": "Timeout in seconds (default: 5)",
"default": 5,
"description": "Timeout in seconds (default: 30)",
"default": 30,
},
},
Required: []string{"key"},
@@ -3649,8 +3649,8 @@ func main() {
},
"timeout": map[string]any{
"type": "integer",
"description": "Timeout in seconds (default: 5)",
"default": 5,
"description": "Timeout in seconds (default: 30)",
"default": 30,
},
},
Required: []string{"selector", "modifiers"},