Commit b0f6554
Sash Zats [email protected]
Store and pass original request when response arrives
Summary: Looks like there were multiple issues with parsing response:
1. It appears that we would mistakenly pass response both for response and request arguments in the private func handleResponse(_ response: Response<AnyMethod>, for request: Any)
2. Later I couldn't figure out how to win against swift type system, so ended up creating a type-erased request to store in the pendingRequests instead of original type under Any (that wouldn't allow to downcast original type later)
Test Plan:
1. Standup iMCP client from https://github.com/loopwork-ai/iMCP
2. Create a dummy project setting up MCP client against "/private/var/folders/26/8gncz37x7slbfrr95d9jcr400000gn/T/AppTranslocation/62ADEC4D-3545-4E98-A612-0E6DF52CE525/d/iMCP.app/Contents/MacOS/imcp-server" and call initialize
Note response is being parsed correctly and client.initialize() does not hang indefinitely1 parent b1ccf31 commit b0f6554
1 file changed
+45
-15
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
87 | 87 | | |
88 | 88 | | |
89 | 89 | | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
90 | 122 | | |
91 | 123 | | |
92 | 124 | | |
93 | 125 | | |
94 | 126 | | |
95 | | - | |
| 127 | + | |
96 | 128 | | |
97 | 129 | | |
98 | 130 | | |
| |||
129 | 161 | | |
130 | 162 | | |
131 | 163 | | |
132 | | - | |
133 | | - | |
| 164 | + | |
| 165 | + | |
134 | 166 | | |
135 | 167 | | |
136 | 168 | | |
| |||
220 | 252 | | |
221 | 253 | | |
222 | 254 | | |
223 | | - | |
| 255 | + | |
224 | 256 | | |
225 | 257 | | |
226 | 258 | | |
227 | 259 | | |
228 | | - | |
| 260 | + | |
229 | 261 | | |
230 | 262 | | |
231 | 263 | | |
| |||
320 | 352 | | |
321 | 353 | | |
322 | 354 | | |
323 | | - | |
| 355 | + | |
324 | 356 | | |
325 | 357 | | |
326 | 358 | | |
327 | 359 | | |
328 | 360 | | |
329 | | - | |
330 | | - | |
331 | | - | |
332 | | - | |
333 | | - | |
334 | | - | |
335 | | - | |
336 | | - | |
337 | | - | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
338 | 368 | | |
339 | 369 | | |
340 | 370 | | |
| |||
0 commit comments