Add skill definitions (SKILL.md + run.py) for all agent tools
This commit is contained in:
13
skills/web_search/SKILL.md
Normal file
13
skills/web_search/SKILL.md
Normal file
@@ -0,0 +1,13 @@
|
||||
---
|
||||
name: web_search
|
||||
description: Search the web using SearXNG. Returns titles, URLs, and snippets for the top results. Use this when you need current information or facts you're unsure about.
|
||||
parameters:
|
||||
query:
|
||||
type: string
|
||||
description: The search query
|
||||
required: true
|
||||
num_results:
|
||||
type: integer
|
||||
description: Number of results to return (default 5)
|
||||
required: false
|
||||
---
|
||||
32
skills/web_search/run.py
Normal file
32
skills/web_search/run.py
Normal file
@@ -0,0 +1,32 @@
|
||||
#!/usr/bin/env python3
|
||||
import sys
|
||||
import json
|
||||
import urllib.request
|
||||
import urllib.parse
|
||||
|
||||
args = json.loads(sys.stdin.read())
|
||||
query = args.get("query", "")
|
||||
num_results = args.get("num_results", 5)
|
||||
searx_url = args.get("_searx_url", "https://searx.mymx.me")
|
||||
|
||||
try:
|
||||
params = urllib.parse.urlencode({"q": query, "format": "json"})
|
||||
req = urllib.request.Request(
|
||||
f"{searx_url}/search?{params}",
|
||||
headers={"User-Agent": "fireclaw-agent"},
|
||||
)
|
||||
with urllib.request.urlopen(req, timeout=15) as resp:
|
||||
data = json.loads(resp.read())
|
||||
results = data.get("results", [])[:num_results]
|
||||
if not results:
|
||||
print("No results found.")
|
||||
else:
|
||||
lines = []
|
||||
for r in results:
|
||||
title = r.get("title", "")
|
||||
url = r.get("url", "")
|
||||
snippet = r.get("content", "")[:150]
|
||||
lines.append(f"- {title}\n {url}\n {snippet}")
|
||||
print("\n".join(lines))
|
||||
except Exception as e:
|
||||
print(f"[search error: {e}]")
|
||||
Reference in New Issue
Block a user