From fbb9fd3f749b79e905c25b4d24b3d7e44369636f Mon Sep 17 00:00:00 2001 From: Arun Isaac Date: Wed, 8 Apr 2026 20:47:29 +0100 Subject: Raise &tool-call-parse-failure from spec->tool-call. --- kaakaa/tools.scm | 16 +++++++++++++--- 1 file 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{} -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 -- cgit 1.4.1