From 5f2dd010a8193a5dd7e836bc31d75daf4bf6aaa1 Mon Sep 17 00:00:00 2001 From: Jonathon McKitrick Date: Wed, 8 Oct 2025 14:42:05 -0400 Subject: [PATCH 1/2] Add new prompt to save custom user prompts to config --- src/clojure_mcp/prompts.clj | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/clojure_mcp/prompts.clj b/src/clojure_mcp/prompts.clj index 64673cba..aa66d55c 100644 --- a/src/clojure_mcp/prompts.clj +++ b/src/clojure_mcp/prompts.clj @@ -280,6 +280,28 @@ After doing this provide a very brief (8 lines) summary of where we are and then (.getPath file) (.getMessage e))}]})))))))}) +(def save-new-prompt + {:name "save_new_prompt" + :description "Asks the user for a new prompt and a name, and saves them to their user config" + :arguments [{:name "prompt_name" + :description "Name for this prompt" + :required? true} + {:name "prompt_text" + :description "Text content for this prompt" + :required? true}] + :prompt-fn (fn [_ request-args clj-result-k] + (let [prompt-name (get request-args "prompt_name") + prompt-text (get request-args "prompt_text")] + (clj-result-k + {:description (str "Create prompt: " prompt-name) + :messages [{:role :user + :content (format + "Save %s in the `.clojure-mcp` project folder, in the `config.edn` file under the `:prompts` key using the STRING key %s, using the following format: +`:description` - \"Custom user-added prompt\" +`:content` - %s +" + prompt-name prompt-name prompt-text)}]})))}) + (defn create-prompt-from-config "Creates a prompt from configuration map. Config should have :description, :args, and either :file-path or :content. @@ -338,6 +360,7 @@ After doing this provide a very brief (8 lines) summary of where we are and then (str (load-prompt-from-resource "clojure-mcp/prompts/system/clojure_repl_form_edit.md") (load-prompt-from-resource "clojure-mcp/prompts/system/clojure_form_edit.md")))} + save-new-prompt (create-project-summary working-dir) chat-session-summary resume-chat-session From 794e5800d637be52e191ba72a3d2341d4e00fc21 Mon Sep 17 00:00:00 2001 From: Jonathon McKitrick Date: Fri, 10 Oct 2025 14:09:01 -0400 Subject: [PATCH 2/2] Tweak prompt creation --- src/clojure_mcp/prompts.clj | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/src/clojure_mcp/prompts.clj b/src/clojure_mcp/prompts.clj index aa66d55c..3bb35fc8 100644 --- a/src/clojure_mcp/prompts.clj +++ b/src/clojure_mcp/prompts.clj @@ -283,24 +283,27 @@ After doing this provide a very brief (8 lines) summary of where we are and then (def save-new-prompt {:name "save_new_prompt" :description "Asks the user for a new prompt and a name, and saves them to their user config" - :arguments [{:name "prompt_name" - :description "Name for this prompt" - :required? true} - {:name "prompt_text" - :description "Text content for this prompt" - :required? true}] :prompt-fn (fn [_ request-args clj-result-k] - (let [prompt-name (get request-args "prompt_name") - prompt-text (get request-args "prompt_text")] - (clj-result-k - {:description (str "Create prompt: " prompt-name) - :messages [{:role :user - :content (format - "Save %s in the `.clojure-mcp` project folder, in the `config.edn` file under the `:prompts` key using the STRING key %s, using the following format: + (clj-result-k + {:description "Help user create/update a custom prompt" + :messages [{:role :user + :content "Here is how you create a new prompt: +1. In the `.clojure-mcp` project folder, find the `config.edn` file. +2. Under the `:prompts` key will be a map of strings (which name the prompts) and maps (which define the prompts). +3. Note that each prompt has a description and content, and may also have arguments. +4. Read each prompt, and ask the user if they want to create a new prompt or edit an existing prompt. +5. Ask the user what they want the prompt to do. +6. Help the user compose the content of the prompt, including any arguments, if required. +7. If this is a new prompt, save it as described below. +8. If this is an existing prompt, update the existing prompt. + +How to save a prompt: + +Save prompt in the `.clojure-mcp` project folder, in the `config.edn` file under the `:prompts` key using the STRING name of the prompt as the key, +and using the following format: `:description` - \"Custom user-added prompt\" `:content` - %s -" - prompt-name prompt-name prompt-text)}]})))}) +`:args` - vector of args, where each arg is a map of `:name`, `:description`, and a `:required?` flag."}]}))}) (defn create-prompt-from-config "Creates a prompt from configuration map.