Commitf37a2871Recorded22 Apr 2026Repositorybureau

Merge fix/bureau-require-arg-shared-module

Changed
 src/bureau/calendar.sgl |  3 ++-
 src/bureau/email.sgl    | 15 ++-------------
 src/bureau/util.sgl     | 16 ++++++++++++++++
 3 files changed, 20 insertions(+), 14 deletions(-)
Diff

A merge. Shown against its first parent, so this is the effect of merging rather than the work of the branch.

src/bureau/calendar.sglmodified
@@ -13,7 +13,8 @@
13
(sigil caldav)
14
(bureau connection)
15
(bureau config)
16
(bureau format))
+16
(bureau format)
+17
(bureau util))
18
(export register-calendar-tools!
19
;; Exported for testing
20
find-free-slots
src/bureau/email.sglmodified
@@ -10,24 +10,13 @@
10
(sigil fs)
11
(sigil jmap)
12
(bureau connection)
13
(bureau format))
+13
(bureau format)
+14
(bureau util))
15
(export register-email-tools!
16
parse-id-list
17
normalize-utc-date)
18
(begin
19
19
;; ============================================================
20
;; Argument validation
21
;; ============================================================
22
23
;; Look up a required argument in a tool's args dict. Raises a
24
;; user-facing error naming the missing key instead of sigil's
25
;; opaque `dict-ref: key not found`.
26
(define (require-arg args key name)
27
(if (dict-contains? args key)
28
(dict-ref args key)
29
(error (string-append "Missing required argument: " name))))
30
20
;; ============================================================
21
;; Mailbox Resolution
22
;; ============================================================
src/bureau/util.sgladded
@@ -0,0 +1,16 @@
+1
;;; (bureau util) - Cross-cutting helpers shared across bureau modules.
+2
+3
(define-library (bureau util)
+4
(import (sigil core)
+5
(sigil string))
+6
(export require-arg)
+7
(begin
+8
+9
;; Look up a required argument in a tool's args dict. Raises a
+10
;; user-facing error naming the missing key instead of sigil's
+11
;; opaque `dict-ref: key not found`. See
+12
;; topics/mcp-tool-arg-validation-pattern in folio for context.
+13
(define (require-arg args key name)
+14
(if (dict-contains? args key)
+15
(dict-ref args key)
+16
(error (string-append "Missing required argument: " name))))))