File tree Expand file tree Collapse file tree 2 files changed +19
-14
lines changed
Expand file tree Collapse file tree 2 files changed +19
-14
lines changed Original file line number Diff line number Diff line change 107107 (keep (fn [{:keys [client tools]}]
108108 (when (some #(= name (:name %)) tools)
109109 client)))
110- first)
111- result (.callTool ^McpSyncClient mcp-client
112- (McpSchema$CallToolRequest. name arguments))]
113- (logger/debug logger-tag " ToolCall result: " result)
114- {:contents (map (fn [content]
115- (case (.type ^McpSchema$Content content)
116- " text" {:type :text
117- :error (.isError result)
118- :content (.text ^McpSchema$TextContent content)}
119- nil ))
120- (.content result))}))
110+ first)]
111+ (try
112+ (let [result (.callTool ^McpSyncClient mcp-client
113+ (McpSchema$CallToolRequest. name arguments))]
114+ (logger/debug logger-tag " ToolCall result: " result)
115+ {:contents (map (fn [content]
116+ (case (.type ^McpSchema$Content content)
117+ " text" {:type :text
118+ :error (.isError result)
119+ :content (.text ^McpSchema$TextContent content)}
120+ nil ))
121+ (.content result))})
122+ (catch Exception e
123+ {:contents [{:type :text
124+ :error true
125+ :content (.getMessage e)}]}))))
121126
122127(defn shutdown! [db*]
123128 (doseq [[_name {:keys [_client]}] (:mcp-clients @db*)]
Original file line number Diff line number Diff line change 2323 {}))))
2424 (testing " Include enabled native tools"
2525 (is (match?
26- (m/embeds [{:name " list_directory "
26+ (m/embeds [{:name " eca_list_directory "
2727 :description string?
2828 :parameters some?
2929 :source :native }])
3030 (f.tools/all-tools {} {:nativeTools {:filesystem {:enabled true }}}))))
3131 (testing " Do not include disabled native tools"
3232 (is (match?
33- (m/embeds [(m/mismatch {:name " list_directory " })])
33+ (m/embeds [(m/mismatch {:name " eca_list_directory " })])
3434 (f.tools/all-tools {} {:nativeTools {:filesystem {:enabled false }}}))))
3535 (testing " Replace special vars description"
3636 (is (match?
37- (m/embeds [{:name " list_directory "
37+ (m/embeds [{:name " eca_list_directory "
3838 :description (format " Only in %s" (h/file-path " /path/to/project/foo" ))
3939 :parameters some?
4040 :source :native }])
You can’t perform that action at this time.
0 commit comments