|
32 | 32 | (get-in config [:behavior behavior :disabledTools] []) |
33 | 33 | [])))) |
34 | 34 |
|
| 35 | +(defn ^:private tool-disabled? [tool disabled-tools] |
| 36 | + (or (contains? disabled-tools (str (:name (:server tool)) "__" (:name tool))) |
| 37 | + (contains? disabled-tools (:name tool)))) |
| 38 | + |
35 | 39 | (defn make-tool-status-fn |
36 | 40 | "Returns a function that marks tools as disabled based on config and behavior. |
37 | 41 | If behavior is nil, only uses global disabledTools." |
38 | 42 | [config behavior] |
39 | 43 | (let [disabled-tools (get-disabled-tools config behavior)] |
40 | 44 | (fn [tool] |
41 | | - (assoc-some tool :disabled (contains? disabled-tools (:name tool)))))) |
| 45 | + (assoc-some tool :disabled (tool-disabled? tool disabled-tools))))) |
42 | 46 |
|
43 | 47 | (defn ^:private replace-string-values-with-vars |
44 | 48 | "walk through config parsing dynamic string contents if value is a string." |
|
76 | 80 | (let [disabled-tools (get-disabled-tools config behavior)] |
77 | 81 | (filterv |
78 | 82 | (fn [tool] |
79 | | - (and (not (contains? disabled-tools (:name tool))) |
| 83 | + (and (not (tool-disabled? tool disabled-tools)) |
80 | 84 | ;; check for enabled-fn if present |
81 | 85 | ((or (:enabled-fn tool) (constantly true)) |
82 | 86 | {:behavior behavior |
|
142 | 146 | :status "running" |
143 | 147 | :tools (->> (native-tools @db* config) |
144 | 148 | (remove #(= "compact_chat" (:name %))) |
145 | | - (mapv #(select-keys % [:name :description :parameters])) |
146 | | - (mapv tool-status-fn))}) |
| 149 | + (mapv tool-status-fn) |
| 150 | + (mapv #(select-keys % [:name :description :parameters :disabled])))}) |
147 | 151 | (f.mcp/initialize-servers-async! |
148 | 152 | {:on-server-updated (partial notify-server-updated metrics messenger tool-status-fn)} |
149 | 153 | db* |
|
280 | 284 | :name "ECA" |
281 | 285 | :status "running" |
282 | 286 | :tools (->> (native-tools @db* config) |
283 | | - (mapv #(select-keys % [:name :description :parameters])) |
284 | | - (mapv tool-status-fn))}) |
| 287 | + (mapv tool-status-fn) |
| 288 | + (mapv #(select-keys % [:name :description :parameters :disabled])))}) |
285 | 289 | (doseq [[server-name {:keys [tools status]}] (:mcp-clients @db*)] |
286 | 290 | (messenger/tool-server-updated messenger {:type :mcp |
287 | 291 | :name server-name |
|
0 commit comments