Skip to content

Commit b1a0e6b

Browse files
committed
Improve tool call
1 parent d79298a commit b1a0e6b

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
- Support http MCP servers that require oauth. #51
66
- Add basic username/password proxy authentication support and recognize lowercase http[s]_proxy env var alongside HTTP[S]_PROXY. #248
7+
- Avoid tool call of invalid names
78

89
## 0.88.0
910

src/eca/features/tools.clj

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,16 @@
100100
(let [[server-name tool-name] (string/split full-name #"__")
101101
arguments (update-keys arguments clojure.core/name)
102102
db @db*
103-
tool-meta (some #(when (= full-name (:full-name %)) %)
104-
(all-tools chat-id behavior db config))
103+
all-tools (all-tools chat-id behavior db config)
104+
tool-meta (some #(when (= full-name (:full-name %)) %) all-tools)
105105
required-args-error (when-let [parameters (:parameters tool-meta)]
106106
(tools.util/required-params-error parameters arguments))]
107107
(try
108+
(when-not tool-meta
109+
(throw (ex-info (format "Tool '%s' not found" full-name) {:full-name full-name
110+
:server-name server-name
111+
:arguments arguments
112+
:all-tools (mapv :full-name all-tools)})))
108113
(let [result (-> (if required-args-error
109114
required-args-error
110115
(if-let [native-tool-handler (and (= "eca" server-name)

0 commit comments

Comments
 (0)