commit c7b4b40b9793a7cd6ea51a7e10cb28c7c9e7fa93
parent 432d56ef45c9369bc87518b3c8d305eeb40e6dd6
Author: Vineet Kumar <git@vineetk.net>
Date: Mon, 25 May 2026 23:15:50 -0400
update read_file tool definition based on finalized hashline changes
Diffstat:
| M | llm-tools.el | | | 43 | +++++++++++++++++++++++++++++++++++++------ |
1 file changed, 37 insertions(+), 6 deletions(-)
diff --git a/llm-tools.el b/llm-tools.el
@@ -6,10 +6,11 @@
:name "read_file"
:function 'llm-tools--hl-file-read
:description "\
-Read an entire file and return its contents in hashline format. Each
-line is represented as LINE_NUMBER HASH|CONTENT, where LINE_NUMBER is
-the 1-based line number, HASH is a 2-character content-derived bigram,
-and CONTENT is the verbatim line text. Example output:
+Read a file (or a range of lines) and return its contents in hashline
+format. Each line is represented as LINE_NUMBER HASH|CONTENT, where
+LINE_NUMBER is nthe 1-based line number, HASH is a 2-character
+content-derived bigram, and CONTENT is the verbatim line text. Example
+output:
1aa|const char *TITLE = \"Mr\";
2ab|void greet(char *name) {
@@ -20,10 +21,40 @@ uniquely identifies a line by position and content. Copy anchors
verbatim from the output when referencing lines in edit operations. Do
not fabricate or modify hashes. Call this tool before editing any file
to obtain current content and valid anchors. Re-call if anchors no
-longer match after external changes."
+longer match after external changes.
+
+Use optional BEG and END arguments to read only a specific range of
+lines (1-based, inclusive). Use ONLY_ANCHORS to retrieve just the line
+anchors without content. Use AS_LIST to receive output as a list rather
+than a newline-delimited string."
:args '((:name "file"
:type string
- :description "Path to the file to read, relative to the working directory."))
+ :description "\
+Path to the file to read, relative to the working directory.")
+ (:name "beg"
+ :type integer
+ :description "\
+Optional 1-based line number (inclusive) to start reading from. Omit to
+read from the beginning."
+ :optional t)
+ (:name "end"
+ :type integer
+ :description "\
+Optional 1-based line number (inclusive) to stop reading at. Omit to
+read to the end."
+ :optional t)
+ (:name "only_anchors"
+ :type boolean
+ :description "\
+Optional boolean. When true, returns only the anchor (line number +
+hash) without the content portion after the pipe."
+ :optional t)
+ (:name "as_list"
+ :type boolean
+ :description "\
+Optional boolean. When true, returns each hashline as a list element
+instead of a single newline-delimited string."
+ :optional t))
:async nil
:confirm nil
:include t)