Function: gptel--steer-tool-calls
gptel--steer-tool-calls is an interactive and natively compiled
function defined in gptel.el.
Signature
(gptel--steer-tool-calls &optional TOOL-CALLS OV INFO)
Documentation
Reject pending TOOL-CALLS and continue the request chain.
Feed a rejection message to the LLM for each tool call so the conversation can proceed. OV is the tool call dispatch overlay, INFO is the request state plist.
Key Bindings
gptel-tool-call-actions-map C-c C-r
Source Code
;; Defined in /nix/store/q3r7g81pvghw7a523kjk2k2zih3pfk8z-emacs-packages-deps/share/emacs/site-lisp/elpa/gptel-20261002.545/gptel.el
(defun gptel--steer-tool-calls (&optional tool-calls ov info)
"Reject pending TOOL-CALLS and continue the request chain.
Feed a rejection message to the LLM for each tool call so the
conversation can proceed. OV is the tool call dispatch overlay, INFO is
the request state plist."
(interactive (pcase-let ((`(,resp . ,o) (get-char-property-and-overlay
(point) 'gptel-tool)))
(list resp o (and (overlayp o) (overlay-get o 'info)))))
(setq info (or info (and (overlayp ov) (overlay-get ov 'info))))
(when (and tool-calls info)
(gptel--update-status " Tools rejected" 'error)
(let* ((tool-result "Tool call rejected by user.")
(msg (read-string "Reject with instructions: "
nil nil tool-result)))
(plist-put info :steering-message msg)
(cl-loop for (_tool-spec _arg-plist process-tool-result) in tool-calls
do (funcall process-tool-result tool-result))))
(when (and (overlayp ov) (overlay-buffer ov))
(with-current-buffer (overlay-buffer ov)
(when-let* ((preview-handles (overlay-get ov 'previews)))
(dolist (func-to-handle preview-handles)
(when (car func-to-handle) (apply func-to-handle))))
(dolist (prompt-ov (overlay-get ov 'prompt))
(when-let* (((overlay-buffer prompt-ov))
(inhibit-read-only t))
(delete-region (overlay-start prompt-ov)
(overlay-end prompt-ov)))))
(delete-overlay ov)))