Commite35232bbRecorded2 Sep 2026Repositorysigil-mcp
fix(client): parse JSON frames without sentinel constructors
Changed
src/sigil/mcp/protocol.sgl | 28 ++++++++++++++--------------
1 file changed, 14 insertions(+), 14 deletions(-)Diff
src/sigil/mcp/protocol.sglmodified
@@ -108,26 +108,26 @@
108
(define (parse-message json) 109
(and (dict? json) 110
(equal? (dict-ref json jsonrpc: #f) "2.0")−111
(let* ((missing (list 'missing-jsonrpc-field))−112
(method (dict-ref json method: #f))−113
(id (dict-ref json id: missing))−114
(result (dict-ref json result: missing))−115
(error-value (dict-ref json error: missing))−116
(has-id? (not (eq? id missing)))−117
(has-result? (not (eq? result missing)))−118
(has-error? (not (eq? error-value missing)))+111
(let* ((method (dict-ref json method: #f))+112
(has-id? (dict-contains? json id:))+113
(has-result? (dict-contains? json result:))+114
(has-error? (dict-contains? json error:))+115
(id (dict-ref json id: #f))+116
(error-value (dict-ref json error: #f)) 117
(params (dict-ref json params: #f))) 118
(cond 119
((and has-id? has-result? (not has-error?))−122
(make-response id result))+120
(jsonrpc-response+121
id: id+122
result: (dict-ref json result:))) 123
((and has-id? has-error? (dict? error-value)) 124
(and (number? (dict-ref error-value code: #f)) 125
(string? (dict-ref error-value message: #f))−126
(make-error-response−127
id−128
(dict-ref error-value code:)−129
(dict-ref error-value message:)−130
(dict-ref error-value data: #f))))+126
(jsonrpc-error-response+127
id: id+128
code: (dict-ref error-value code:)+129
message: (dict-ref error-value message:)+130
data: (dict-ref error-value data: #f)))) 131
((string? method) 132
(if has-id? 133
(jsonrpc-request id: id