|
1 | 1 | ``` ucm
|
2 |
| -scratch/main> builtins.merge |
| 2 | +scratch/main> builtins.mergeio lib.builtins |
3 | 3 |
|
4 | 4 | Done.
|
5 | 5 | ```
|
6 | 6 |
|
| 7 | +``` unison :hide |
| 8 | +README = {{ |
| 9 | + This is a scratch project for testing tools in MCP. |
| 10 | +}} |
| 11 | +
|
| 12 | +myTerm = 99 |
| 13 | +
|
| 14 | +type MyType = MyConstructor |
| 15 | +``` |
| 16 | + |
| 17 | +``` ucm |
| 18 | +scratch/main> update |
| 19 | +
|
| 20 | + Okay, I'm searching the branch for code that needs to be |
| 21 | + updated... |
| 22 | +
|
| 23 | + Done. |
| 24 | +``` |
| 25 | + |
| 26 | +## list-project-branches |
| 27 | + |
| 28 | +``` api |
| 29 | +POST /mcp |
| 30 | +BODY: |
| 31 | + { |
| 32 | + "jsonrpc": "2.0", |
| 33 | + "id": 1, |
| 34 | + "method": "tools/call", |
| 35 | + "params": { |
| 36 | + "name": "list-project-branches", |
| 37 | + "arguments": { |
| 38 | + "projectName": "scratch" |
| 39 | + } |
| 40 | + } |
| 41 | + } |
| 42 | +
|
| 43 | +RESPONSE: |
| 44 | + { |
| 45 | + "id": 1, |
| 46 | + "jsonrpc": "2.0", |
| 47 | + "result": { |
| 48 | + "content": [ |
| 49 | + { |
| 50 | + "text": "{\"outputMessages\":[\" Branch Remote branch\\n1. main \"],\"sourceCodeUpdates\":[]}", |
| 51 | + "type": "text" |
| 52 | + } |
| 53 | + ], |
| 54 | + "isError": false |
| 55 | + } |
| 56 | + } |
| 57 | +
|
| 58 | +``` |
| 59 | + |
| 60 | +## typecheck-code |
| 61 | + |
| 62 | +``` api |
| 63 | +POST /mcp |
| 64 | +BODY: |
| 65 | + { |
| 66 | + "jsonrpc": "2.0", |
| 67 | + "id": 1, |
| 68 | + "method": "tools/call", |
| 69 | + "params": { |
| 70 | + "name": "typecheck-code", |
| 71 | + "arguments": { |
| 72 | + "projectContext": { |
| 73 | + "projectName": "scratch", |
| 74 | + "branchName": "main" |
| 75 | + }, "code": "> x = 1 + 2" |
| 76 | + } |
| 77 | + } |
| 78 | + } |
| 79 | +
|
| 80 | +RESPONSE: |
| 81 | + { |
| 82 | + "id": 1, |
| 83 | + "jsonrpc": "2.0", |
| 84 | + "result": { |
| 85 | + "content": [ |
| 86 | + { |
| 87 | + "text": "{\"outputMessages\":[\"Loading changes detected in scratch.u.\",\"â
\\n\\nscratch.u changed.\\n\\nNow evaluating any watch expressions (lines starting with `>`)... Ctrl+C cancels.\",\" 1 | > x = 1 + 2\\n â§©\\n 3\"],\"sourceCodeUpdates\":[]}", |
| 88 | + "type": "text" |
| 89 | + } |
| 90 | + ], |
| 91 | + "isError": false |
| 92 | + } |
| 93 | + } |
| 94 | +
|
| 95 | +``` |
| 96 | + |
| 97 | +## docs |
| 98 | + |
| 99 | +``` api |
| 100 | +POST /mcp |
| 101 | +BODY: |
| 102 | + { |
| 103 | + "jsonrpc": "2.0", |
| 104 | + "id": 1, |
| 105 | + "method": "tools/call", |
| 106 | + "params": { |
| 107 | + "name": "docs", |
| 108 | + "arguments": { |
| 109 | + "projectContext": { |
| 110 | + "projectName": "scratch", |
| 111 | + "branchName": "main" |
| 112 | + }, "name": "README" |
| 113 | + } |
| 114 | + } |
| 115 | + } |
| 116 | +
|
| 117 | +RESPONSE: |
| 118 | + { |
| 119 | + "id": 1, |
| 120 | + "jsonrpc": "2.0", |
| 121 | + "result": { |
| 122 | + "content": [ |
| 123 | + { |
| 124 | + "text": "{\"outputMessages\":[\"This is a scratch project for testing tools in MCP.\\n\\n\\n\"],\"sourceCodeUpdates\":[]}", |
| 125 | + "type": "text" |
| 126 | + } |
| 127 | + ], |
| 128 | + "isError": false |
| 129 | + } |
| 130 | + } |
| 131 | +
|
| 132 | +``` |
| 133 | + |
| 134 | +## list-project-definitions |
| 135 | + |
| 136 | +``` api |
| 137 | +POST /mcp |
| 138 | +BODY: |
| 139 | + { |
| 140 | + "jsonrpc": "2.0", |
| 141 | + "id": 1, |
| 142 | + "method": "tools/call", |
| 143 | + "params": { |
| 144 | + "name": "list-project-definitions", |
| 145 | + "arguments": { |
| 146 | + "projectContext": { |
| 147 | + "projectName": "scratch", |
| 148 | + "branchName": "main" |
| 149 | + } |
| 150 | + } |
| 151 | + } |
| 152 | + } |
| 153 | +
|
| 154 | +RESPONSE: |
| 155 | + { |
| 156 | + "id": 1, |
| 157 | + "jsonrpc": "2.0", |
| 158 | + "result": { |
| 159 | + "content": [ |
| 160 | + { |
| 161 | + "text": "{\"content\":[{\"text\":\"{\\\"outputMessages\\\":[\\\"1. myTerm : Nat\\\\n2. type MyType\\\\n3. MyType.MyConstructor : MyType\\\\n4. README : Doc2\\\\n\\\"],\\\"sourceCodeUpdates\\\":[]}\",\"type\":\"text\"}],\"isError\":false}", |
| 162 | + "type": "text" |
| 163 | + } |
| 164 | + ], |
| 165 | + "isError": false |
| 166 | + } |
| 167 | + } |
| 168 | +
|
| 169 | +``` |
| 170 | + |
| 171 | +## list-project-libraries |
| 172 | + |
| 173 | +``` api |
| 174 | +POST /mcp |
| 175 | +BODY: |
| 176 | + { |
| 177 | + "jsonrpc": "2.0", |
| 178 | + "id": 1, |
| 179 | + "method": "tools/call", |
| 180 | + "params": { |
| 181 | + "name": "list-project-libraries", |
| 182 | + "arguments": { |
| 183 | + "projectContext": { |
| 184 | + "projectName": "scratch", |
| 185 | + "branchName": "main" |
| 186 | + } |
| 187 | + } |
| 188 | + } |
| 189 | + } |
| 190 | +
|
| 191 | +RESPONSE: |
| 192 | + { |
| 193 | + "id": 1, |
| 194 | + "jsonrpc": "2.0", |
| 195 | + "result": { |
| 196 | + "content": [ |
| 197 | + { |
| 198 | + "text": "{\"outputMessages\":[\"1. builtins/ (657 terms, 96 types)\"],\"sourceCodeUpdates\":[]}", |
| 199 | + "type": "text" |
| 200 | + } |
| 201 | + ], |
| 202 | + "isError": false |
| 203 | + } |
| 204 | + } |
| 205 | +
|
| 206 | +``` |
| 207 | + |
| 208 | +## list-project-branches |
| 209 | + |
7 | 210 | ``` api
|
8 |
| --- Namespace segment prefix search |
9 | 211 | POST /mcp
|
10 | 212 | BODY:
|
11 | 213 | {
|
@@ -36,3 +238,146 @@ RESPONSE:
|
36 | 238 | }
|
37 | 239 |
|
38 | 240 | ```
|
| 241 | + |
| 242 | +## view-definitions |
| 243 | + |
| 244 | +``` api |
| 245 | +POST /mcp |
| 246 | +BODY: |
| 247 | + { |
| 248 | + "jsonrpc": "2.0", |
| 249 | + "id": 1, |
| 250 | + "method": "tools/call", |
| 251 | + "params": { |
| 252 | + "name": "view-definitions", |
| 253 | + "arguments": { |
| 254 | + "projectContext": { |
| 255 | + "projectName": "scratch", |
| 256 | + "branchName": "main" |
| 257 | + }, "names": ["myTerm", "MyType"] |
| 258 | + } |
| 259 | + } |
| 260 | + } |
| 261 | +
|
| 262 | +RESPONSE: |
| 263 | + { |
| 264 | + "id": 1, |
| 265 | + "jsonrpc": "2.0", |
| 266 | + "result": { |
| 267 | + "content": [ |
| 268 | + { |
| 269 | + "text": "{\"outputMessages\":[\"type MyType = MyConstructor\\n\\nmyTerm : Nat\\nmyTerm = 99\"],\"sourceCodeUpdates\":[]}", |
| 270 | + "type": "text" |
| 271 | + } |
| 272 | + ], |
| 273 | + "isError": false |
| 274 | + } |
| 275 | + } |
| 276 | +
|
| 277 | +``` |
| 278 | + |
| 279 | +## search-definitions-by-name |
| 280 | + |
| 281 | +``` api |
| 282 | +POST /mcp |
| 283 | +BODY: |
| 284 | + { |
| 285 | + "jsonrpc": "2.0", |
| 286 | + "id": 1, |
| 287 | + "method": "tools/call", |
| 288 | + "params": { |
| 289 | + "name": "search-definitions-by-name", |
| 290 | + "arguments": { |
| 291 | + "projectContext": { |
| 292 | + "projectName": "scratch", |
| 293 | + "branchName": "main" |
| 294 | + }, "query": "my" |
| 295 | + } |
| 296 | + } |
| 297 | + } |
| 298 | +
|
| 299 | +RESPONSE: |
| 300 | + { |
| 301 | + "id": 1, |
| 302 | + "jsonrpc": "2.0", |
| 303 | + "result": { |
| 304 | + "content": [ |
| 305 | + { |
| 306 | + "text": "{\"outputMessages\":[\"1. myTerm : Nat\\n2. type MyType\\n3. MyType.MyConstructor : MyType\\n\"],\"sourceCodeUpdates\":[]}", |
| 307 | + "type": "text" |
| 308 | + } |
| 309 | + ], |
| 310 | + "isError": false |
| 311 | + } |
| 312 | + } |
| 313 | +
|
| 314 | +``` |
| 315 | + |
| 316 | +## search-by-type |
| 317 | + |
| 318 | +``` api |
| 319 | +POST /mcp |
| 320 | +BODY: |
| 321 | + { |
| 322 | + "jsonrpc": "2.0", |
| 323 | + "id": 1, |
| 324 | + "method": "tools/call", |
| 325 | + "params": { |
| 326 | + "name": "search-by-type", |
| 327 | + "arguments": { |
| 328 | + "projectContext": { |
| 329 | + "projectName": "scratch", |
| 330 | + "branchName": "main" |
| 331 | + }, "query": "Nat" |
| 332 | + } |
| 333 | + } |
| 334 | + } |
| 335 | +
|
| 336 | +RESPONSE: |
| 337 | + { |
| 338 | + "id": 1, |
| 339 | + "jsonrpc": "2.0", |
| 340 | + "result": { |
| 341 | + "content": [ |
| 342 | + { |
| 343 | + "text": "{\"outputMessages\":[\"1. myTerm : Nat\\n\"],\"sourceCodeUpdates\":[]}", |
| 344 | + "type": "text" |
| 345 | + } |
| 346 | + ], |
| 347 | + "isError": false |
| 348 | + } |
| 349 | + } |
| 350 | +
|
| 351 | +``` |
| 352 | + |
| 353 | +## get-current-project-context |
| 354 | + |
| 355 | +``` api |
| 356 | +POST /mcp |
| 357 | +BODY: |
| 358 | + { |
| 359 | + "jsonrpc": "2.0", |
| 360 | + "id": 1, |
| 361 | + "method": "tools/call", |
| 362 | + "params": { |
| 363 | + "name": "get-current-project-context", |
| 364 | + "arguments": { } |
| 365 | + } |
| 366 | + } |
| 367 | +
|
| 368 | +RESPONSE: |
| 369 | + { |
| 370 | + "id": 1, |
| 371 | + "jsonrpc": "2.0", |
| 372 | + "result": { |
| 373 | + "content": [ |
| 374 | + { |
| 375 | + "text": "{\"branchName\":\"main\",\"projectName\":\"scratch\"}", |
| 376 | + "type": "text" |
| 377 | + } |
| 378 | + ], |
| 379 | + "isError": false |
| 380 | + } |
| 381 | + } |
| 382 | +
|
| 383 | +``` |
0 commit comments