summaryrefslogtreecommitdiffstats
path: root/examples/tools
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-09-26 08:01:16 +0200
committerDanilo M. <danix@danix.xyz>2026-09-26 08:01:16 +0200
commit8685afde21bf8e94071dbf0b0171b4a2e91492cf (patch)
tree1c01c0ab871f8cb1cc126039e8e43f86fca69625 /examples/tools
parentde179d288a1c67bc77756141b16e95c364e941a1 (diff)
downloaddesktop-assistant-8685afde21bf8e94071dbf0b0171b4a2e91492cf.tar.gz
desktop-assistant-8685afde21bf8e94071dbf0b0171b4a2e91492cf.zip
Add example config and the now and search tools
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'examples/tools')
-rw-r--r--examples/tools/now.toml2
-rwxr-xr-xexamples/tools/search.sh29
-rw-r--r--examples/tools/search.toml9
3 files changed, 40 insertions, 0 deletions
diff --git a/examples/tools/now.toml b/examples/tools/now.toml
new file mode 100644
index 0000000..c52a4fe
--- /dev/null
+++ b/examples/tools/now.toml
@@ -0,0 +1,2 @@
+description = "Current local date and time."
+command = ["date", "+%A %d %B %Y, %H:%M"]
diff --git a/examples/tools/search.sh b/examples/tools/search.sh
new file mode 100755
index 0000000..a7d05dc
--- /dev/null
+++ b/examples/tools/search.sh
@@ -0,0 +1,29 @@
+#!/bin/bash
+# desktop-assistant tool: web search through a SearXNG instance.
+# Copyright (C) 2026 Danilo M. <danix@danix.xyz>
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 as published
+# by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+# Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# search.sh QUERY: prints the top 5 results as "title: snippet".
+# Needs SEARXNG_URL (config.toml [env]) with the JSON format enabled.
+
+set -uo pipefail
+
+[ -n "${SEARXNG_URL:-}" ] || { echo "SEARXNG_URL is not set" >&2; exit 1; }
+[ -n "${1:-}" ] || { echo "empty query" >&2; exit 1; }
+
+curl -fsS --max-time 8 --get "$SEARXNG_URL/search" \
+ --data-urlencode "q=$1" --data-urlencode "format=json" \
+ | jq -r '.results[:5][] | "\(.title): \(.content // "")"' \
+ || { echo "search failed" >&2; exit 1; }
diff --git a/examples/tools/search.toml b/examples/tools/search.toml
new file mode 100644
index 0000000..2c6919e
--- /dev/null
+++ b/examples/tools/search.toml
@@ -0,0 +1,9 @@
+description = "Search the web. Use it for facts, news, distances, prices, anything you are not sure about, instead of guessing."
+command = ["search.sh", "{query}"]
+timeout = 10
+announce.it = ["Cerco un attimo.", "Vediamo cosa trovo.", "Controllo."]
+announce.en = ["Let me look that up.", "Let me see what I can find.", "Checking."]
+
+[params.query]
+type = "string"
+description = "Search terms"