File tree Expand file tree Collapse file tree 3 files changed +41
-15
lines changed Expand file tree Collapse file tree 3 files changed +41
-15
lines changed Original file line number Diff line number Diff line change 119119 (update-in [:mcp.prompts/static s] (constantly m))
120120 (update [:mcp.prompts/resources ] (fnil merge {}) (extract-resources m)))))))
121121
122- (comment
123- (println @db*)
124- (-> @db* :mcp.prompts/registry (get " github-issues" ))
125- (update-prompt {} " github-issues" (slurp " prompts/examples/github_issues.md" )))
122+ (defn- has-function? [s]
123+ (fn [m]
124+ (some #(= s (-> % :function :name )) (:functions m))))
125+
126+ (defn parameter-values
127+ " extract parameter values from metadata for the tile"
128+ [function-name]
129+ (->> (:mcp.prompts/registry @db*)
130+ (vals )
131+ (filter (has-function? function-name))
132+ (first )
133+ :metadata
134+ :parameter-values ))
126135
127136; ; the registry.yaml file is a list of refs selected from our catalog
128137(defn registry-refs
136145
137146(comment
138147 (repl/setup-stdout-logger )
148+ (println @db*)
149+ (-> @db* :mcp.prompts/registry (get " github-issues" ))
150+ (update-prompt {} " github-issues" (slurp " prompts/examples/github_issues.md" ))
139151 ; in /$HOME/registry.yaml
140152 (git/collect-unique-cache-dirs
141- (git-cache-refs
142- (registry-refs prompts.core/registry)))
143-
153+ (git-cache-refs
154+ (registry-refs prompts.core/registry)))
155+
144156 ; prompts will come from prompts-cache
145157 ; /prompts or $HOME/.prompts-cache
146158 (git/hashch {:owner " docker" :repo " labs-ai-tools-for-devs" :ref " slim/config" })
147159 (add-refs (registry-refs prompts.core/registry))
148160 (-> @db*
149161 :mcp.prompts/registry
150- pprint))
162+ vals
163+ pprint)
164+ (parameter-values " read_file" ))
165+
Original file line number Diff line number Diff line change 204204 ; ; messages
205205 [{:type " text"
206206 :text (->>
207- tool-outputs
208- (map :content )
209- (apply str))}]
207+ tool-outputs
208+ (map :content )
209+ (apply str))}]
210210 ; ; tool call responses
211211 (->> tool-outputs
212212 (mapcat (comp :content :result ))
236236 ; ; tool calls are functions, which are arguments,name maps, and ids
237237 ; ; mcp tool call params are also maps of name, and arguments
238238 ; ; TODO add the config parameters for just the registry entry that defines the tool
239- [{:function (update params :arguments (fn [arguments] (json/generate-string arguments))) :id " 1" }])
239+ [{:function (update
240+ params :arguments
241+ (fn [arguments]
242+ (logger/trace
243+ (-> arguments
244+ (merge (db/parameter-values (:name params)))
245+ (json/generate-string )))))
246+ :id " 1" }])
240247 (async/reduce conj [])
241248 (async/<!! ))]
242249 ; ; TODO with mcp, tool-calls with errors are still jsonrpc results
316323 ; ; add dynamic refs from prompts volume
317324 (db/add-refs
318325 (concat (->> (:register opts)
319- (map (fn [ref] {:type :static :ref ref})))
326+ (map (fn [ref] {:type :static :ref ref})))
320327 ; ; register dynamic prompts
321- (when (fs/exists? (fs/file registry))
322- (db/registry-refs registry)))))
328+ (when (fs/exists? (fs/file registry))
329+ (db/registry-refs registry)))))
323330
324331(defn server-context
325332 " create chan server options for any io chan server that we build"
Original file line number Diff line number Diff line change 1919 [pogonos.core :as stache]
2020 [pogonos.partials :as partials]
2121 [registry]
22+ repl
2223 schema
2324 [selmer.parser :as selmer]))
2425
220221 (get-prompts {:prompts (fs/file " ./prompts/mcp/stripe.md" )}))
221222
222223(comment
224+ (repl/setup-stdout-logger )
223225 (get-prompts {:prompts (fs/file " ./prompts/examples/curl.md" )})
224226 (get-prompts {:prompts (fs/file " ./prompts/examples/generate-dockerfile.md" )})
225227 (get-prompts {:prompts (fs/file " ./README.md" )})
228+ (get-prompts {:prompts (fs/file " ./prompts/mcp/postgres.md" )})
229+ (get-prompts {:prompts (fs/file " ./prompts/mcp/postgresql.md" )})
226230 (=
227231 ((:prompt-function (get-prompts {:prompts (fs/file " ./prompts/examples/qrencode.md" )})) {:content " mycontent" })
228232 [{:role " user" ,
You can’t perform that action at this time.
0 commit comments