about summary refs log tree commit diff
path: root/kaakaa/tools.scm
diff options
context:
space:
mode:
authorArun Isaac2026-04-08 20:47:29 +0100
committerArun Isaac2026-04-08 23:52:58 +0100
commitfbb9fd3f749b79e905c25b4d24b3d7e44369636f (patch)
tree6322fe6e0b5e18c66c6beea0d34e221faf16d83f /kaakaa/tools.scm
parent9dd7d9c74b04a1f25ac2adf75cc464a2a9149b50 (diff)
downloadkaagum-fbb9fd3f749b79e905c25b4d24b3d7e44369636f.tar.gz
kaagum-fbb9fd3f749b79e905c25b4d24b3d7e44369636f.tar.lz
kaagum-fbb9fd3f749b79e905c25b4d24b3d7e44369636f.zip
Raise &tool-call-parse-failure from spec->tool-call.
Diffstat (limited to 'kaakaa/tools.scm')
-rw-r--r--kaakaa/tools.scm16
1 files changed, 13 insertions, 3 deletions
diff --git a/kaakaa/tools.scm b/kaakaa/tools.scm
index c66f3df..8142d49 100644
--- a/kaakaa/tools.scm
+++ b/kaakaa/tools.scm
@@ -30,7 +30,10 @@
   #:use-module (kaakaa container)
   #:use-module (kaakaa records)
   #:use-module (kaakaa utils)
-  #:export (tool->spec
+  #:export (tool-call-parse-failure?
+            tool-call-parse-failure-message
+
+            tool->spec
             spec->tool-call
             eval-tool-call))
 
@@ -135,14 +138,21 @@
           (json tool-call-result-json)
           (success? tool-call-result-success?)))
 
+(define-condition-type &tool-call-parse-failure &serious
+  tool-call-parse-failure tool-call-parse-failure?
+  (message tool-call-parse-failure-message))
+
 (define-condition-type &tool-call-failure &serious
   tool-call-failure tool-call-failure?
   (message tool-call-failure-message))
 
 (define (spec->tool-call session-id session-cwd spec)
   "Deserialize JSON tool call @var{spec} into a @code{<tool-call>}
-object. @var{session-id} and @var{session-cwd} are the ID and current working
-directory of the session the tool call pertains to."
+object. Raise a @code{&tool-call-parse-failure} condition if deserialization
+fails.
+
+@var{session-id} and @var{session-cwd} are the ID and current working directory
+of the session the tool call pertains to."
   ;; TODO: Assert that type is function, and do more sanitization.
   (tool-call session-id
              session-cwd