summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVineet Kumar <git@vineetk.net>2026-05-23 23:25:40 -0400
committerVineet Kumar <git@vineetk.net>2026-05-23 23:25:40 -0400
commitd57c422cddf657fab565411ffe9956a32ff37230 (patch)
tree5257cd4764fd259071dbea23738f80cdd8863f56
parentc1f458c46ccf874d5d26089871a41c35992b2c1e (diff)
declare second tool (find_files)
-rw-r--r--gptel-tools.el26
1 files changed, 25 insertions, 1 deletions
diff --git a/gptel-tools.el b/gptel-tools.el
index bd76a98..1e8453c 100644
--- a/gptel-tools.el
+++ b/gptel-tools.el
@@ -31,7 +31,31 @@ longer match after external changes."
31;; TODO bash_readonly (shell-command-to-string, whitelisted commands) 31;; TODO bash_readonly (shell-command-to-string, whitelisted commands)
32;; TODO bash (shell-command-to-string, needs heavy filtering) 32;; TODO bash (shell-command-to-string, needs heavy filtering)
33 33
34;; TODO find_files (directory-files-decursively) 34;; find_files (directory-files-recursively)
35(gptel-make-tool
36 :name "find_files"
37 :function (lambda (dir &optional pattern)
38 (let ((git-dir (concat (file-name-as-directory dir) ".git")))
39 (delq nil (mapcar (lambda (f)
40 (unless (string-prefix-p git-dir f) f))
41 (directory-files-recursively dir (or pattern ""))))))
42 :description "\
43Recursively find all files in a given directory, excluding files within
44.git directories. Returns a list of absolute file paths. Optionally
45accepts a pattern to filter file names (e.g., `*.el' for Emacs Lisp
46files). Use this to discover files in a project directory before reading
47or editing them."
48 :args (list '(:name "directory"
49 :type string
50 :description "Path to the directory to be read, relative to the working directory.")
51 '(:name "pattern"
52 :type string
53 :description "Optional file name pattern to filter results, e.g. `*.el' or `*.txt'."
54 :optional t))
55 :async nil
56 :confirm nil
57 :include t)
58
35;; TODO grep (just grep :D) 59;; TODO grep (just grep :D)
36;; TODO fetch_url (use gptel-agent's one as a base, but needs mime handling like PDFs and images) 60;; TODO fetch_url (use gptel-agent's one as a base, but needs mime handling like PDFs and images)
37;; TODO web_search (use gptel-agent's eww/shr method as a base) 61;; TODO web_search (use gptel-agent's eww/shr method as a base)