Variable: gptel-post-tool-call-functions

gptel-post-tool-call-functions is a customizable variable defined in gptel.el.

Value

nil

Documentation

Abnormal hook called after each tool call.

Each hook function is called a plist with the following keys:

:name - the name of the tool being called, a string
:args - a plist of the tool call arguments, as specified in the tool
        definition. For a hypothetical edit_file tool that takes three
        arguments, a FILENAME, an ORIGINAL and REPLACEMENT strings, this
        plist is structured as

  (:filename "/path/to/file.md"
   :original "..."
   :replacement "...")

:result - The tool call result, serialized to a string.
:buffer - The name of the buffer from which the request was sent.
:backend - The name of the gptel backend used for the request.
:model - The name of the gptel model used for the request.

The function can work by side effects and return nil, or return a plist with one or more of the following keys.

:stop - If non-nil, stop the request entirely.
:stop-reason - If :stop is non-nil, the reason for stopping. Intended
               for the user, not the LLM.

:block - If non-nil, continue the request but block this tool call and
           mark it as having erred. Can be a string to send as the
           result instead, typically an explanation for why the tool was
           not run. Intended for the LLM, not the user.

:result - The updated result of this tool call, used instead of the
           tool call output. Not marked as an error.

Source Code

;; Defined in /nix/store/q3r7g81pvghw7a523kjk2k2zih3pfk8z-emacs-packages-deps/share/emacs/site-lisp/elpa/gptel-20261002.545/gptel.el
(defcustom gptel-post-tool-call-functions nil
  "Abnormal hook called after each tool call.

Each hook function is called a plist with the following keys:

:name - the name of the tool being called, a string
:args - a plist of the tool call arguments, as specified in the tool
        definition.  For a hypothetical edit_file tool that takes three
        arguments, a FILENAME, an ORIGINAL and REPLACEMENT strings, this
        plist is structured as

  (:filename \"/path/to/file.md\"
   :original \"...\"
   :replacement \"...\")

:result  - The tool call result, serialized to a string.
:buffer  - The name of the buffer from which the request was sent.
:backend - The name of the gptel backend used for the request.
:model   - The name of the gptel model used for the request.

The function can work by side effects and return nil, or return a plist
with one or more of the following keys.

:stop        - If non-nil, stop the request entirely.
:stop-reason - If :stop is non-nil, the reason for stopping.  Intended
               for the user, not the LLM.

:block -   If non-nil, continue the request but block this tool call and
           mark it as having erred.  Can be a string to send as the
           result instead, typically an explanation for why the tool was
           not run.  Intended for the LLM, not the user.

:result  - The updated result of this tool call, used instead of the
           tool call output.  Not marked as an error."
  :type 'hook
  :group 'gptel)