|
10 | 10 | [clojure-mcp.nrepl-launcher :as nrepl-launcher]) |
11 | 11 | (:import [io.modelcontextprotocol.server.transport |
12 | 12 | StdioServerTransportProvider] |
13 | | - [io.modelcontextprotocol.server McpServer McpServerFeatures |
| 13 | + [io.modelcontextprotocol.server McpServer |
14 | 14 | McpServerFeatures$AsyncToolSpecification |
15 | | - McpServerFeatures$AsyncResourceSpecification] |
| 15 | + McpServerFeatures$AsyncResourceSpecification |
| 16 | + McpServerFeatures$AsyncPromptSpecification] |
16 | 17 | [io.modelcontextprotocol.spec |
17 | 18 | McpSchema$ServerCapabilities |
18 | 19 | McpSchema$Tool |
19 | 20 | McpSchema$CallToolResult |
20 | 21 | McpSchema$TextContent |
21 | | - McpSchema$ImageContent |
22 | 22 | McpSchema$Prompt |
23 | 23 | McpSchema$PromptArgument |
24 | 24 | McpSchema$GetPromptRequest |
25 | 25 | McpSchema$GetPromptResult |
26 | 26 | McpSchema$PromptMessage |
27 | 27 | McpSchema$Role |
28 | | - McpSchema$LoggingLevel |
29 | 28 | McpSchema$Resource |
30 | | - McpSchema$ReadResourceResult |
31 | 29 | McpSchema$TextResourceContents |
32 | | - McpSchema$ResourceContents] |
33 | | - [io.modelcontextprotocol.server McpServer McpServerFeatures |
34 | | - McpServerFeatures$AsyncToolSpecification |
35 | | - McpServerFeatures$AsyncPromptSpecification] |
| 30 | + McpSchema$ReadResourceResult] |
36 | 31 | [reactor.core.publisher Mono] |
37 | 32 | [io.modelcontextprotocol.json McpJsonMapper])) |
38 | 33 |
|
|
47 | 42 | (fn [exchange arguments] |
48 | 43 | (Mono/create |
49 | 44 | (reify java.util.function.Consumer |
50 | | - (accept [this sink] |
| 45 | + (accept [_this sink] |
51 | 46 | (callback-fn |
52 | 47 | exchange |
53 | 48 | arguments |
|
61 | 56 | (file-content/file-response->file-content result) |
62 | 57 | :else (McpSchema$TextContent. " "))) |
63 | 58 |
|
64 | | -(defn ^McpSchema$CallToolResult adapt-results [list-str error?] |
| 59 | +(defn adapt-results ^McpSchema$CallToolResult [list-str error?] |
65 | 60 | (McpSchema$CallToolResult. (vec (keep adapt-result list-str)) error?)) |
66 | 61 |
|
67 | 62 | (defn create-async-tool |
|
95 | 90 | (McpServerFeatures$AsyncToolSpecification. |
96 | 91 | mcp-tool |
97 | 92 | (reify java.util.function.BiFunction |
98 | | - (apply [this exchange arguments] |
| 93 | + (apply [_this exchange arguments] |
99 | 94 | (log/debug (str "Args from MCP: " (pr-str arguments))) |
100 | 95 | (mono-fn exchange arguments)))))) |
101 | 96 |
|
102 | | -(defn ^McpSchema$GetPromptResult adapt-prompt-result |
| 97 | +(defn adapt-prompt-result |
103 | 98 | "Adapts a Clojure prompt result map into an McpSchema$GetPromptResult. |
104 | 99 | Expects a map like {:description \"...\" :messages [{:role :user :content \"...\"}]}" |
| 100 | + ^McpSchema$GetPromptResult |
105 | 101 | [{:keys [description messages]}] |
106 | 102 | (let [mcp-messages (mapv (fn [{:keys [role content]}] |
107 | 103 | (McpSchema$PromptMessage. |
|
144 | 140 | (McpServerFeatures$AsyncPromptSpecification. |
145 | 141 | mcp-prompt |
146 | 142 | (reify java.util.function.BiFunction |
147 | | - (apply [this exchange request] |
| 143 | + (apply [_this exchange request] |
148 | 144 | (mono-fn exchange request)))))) |
149 | 145 |
|
150 | 146 | (defn add-tool |
|
184 | 180 | (McpServerFeatures$AsyncResourceSpecification. |
185 | 181 | resource |
186 | 182 | (reify java.util.function.BiFunction |
187 | | - (apply [this exchange request] |
| 183 | + (apply [_this exchange request] |
188 | 184 | (mono-fn exchange request)))))) |
189 | 185 |
|
190 | 186 | (defn add-resource |
|
245 | 241 | (if (= ::config/schema-error (-> e ex-data :type)) |
246 | 242 | (let [{:keys [errors file-path]} (ex-data e)] |
247 | 243 | (binding [*out* *err*] |
248 | | - (println (str "\n❌ Configuration validation failed!\n")) |
| 244 | + (println "\n❌ Configuration validation failed!\n") |
249 | 245 | (when file-path |
250 | 246 | (println (str "File: " file-path "\n"))) |
251 | 247 | (println "Errors found:") |
|
0 commit comments