Commit433f7315Recorded9 Jul 2026Repositorysigil-mcp

Preserve nREPL doc payloads

Changed
 src/sigil/mcp/nrepl.sgl   |  2 +-
 test/test-nrepl-tools.sgl | 13 +++++++++++++
 2 files changed, 14 insertions(+), 1 deletion(-)
Diff
src/sigil/mcp/nrepl.sglmodified
@@ -114,7 +114,7 @@
114
(summary (response-ref resp ':summary #f))
115
(full (response-ref resp ':full #f)))
116
(cond
117
(doc "No documentation found")
+117
(doc doc)
118
((or name kind signature summary full)
119
(string-join
120
(filter (lambda (s) (and s (not (string=? s ""))))
test/test-nrepl-tools.sglmodified
@@ -25,6 +25,13 @@
25
(define (register-tools server)
26
(register-nrepl-tools! server mcp-server-register-tool!))
27
+28
(define (nrepl-private name)
+29
(let ((saved-module (current-module)))
+30
(set-current-module! (find-module '(sigil mcp nrepl)))
+31
(let ((value (eval name)))
+32
(set-current-module! saved-module)
+33
value)))
+34
35
(define (call-tool server name args)
36
(let* ((msg (jsonrpc-request id: 1 method: "tools/call"
37
params: (dict name: name arguments: args)))
@@ -70,6 +77,12 @@
77
(assert-true (member "sigil/nrepl-macroexpand" tools))
78
(assert-equal 8 (length tools)))))
79
+80
(test-group "nREPL MCP response formatting"
+81
(test "doc formatter preserves doc payloads"
+82
(let ((format-doc (nrepl-private 'format-doc)))
+83
(assert-equal "fixture doc"
+84
(format-doc '(response :id "doc" :status ok :doc "fixture doc"))))))
+85
86
(test-group "nREPL MCP introspection tools"
87
(test "complete, doc, describe, and macroexpand round-trip against live nREPL"
88
(with-nrepl-process