Commit 9532561
committed
fix(mcp): register completions capability and unify generated handlers
This commit fixes an issue where `@McpCompletion` requests were failing
with a "-32601 Missing handler" error because the `completions()` capability
was omitted from the generated `ServerCapabilities`. It also introduces a
major refactor to the APT generation to eliminate duplicate code.
Details:
* Added `capabilities.completions()` to the generated `capabilities()` method.
* Safely stripped lingering AST quotes from `@McpCompletion` annotation
values to ensure precise router matching.
* Refactored `McpRoute` to generate a single, unified handler method accepting
both `McpSyncServerExchange` and `McpTransportContext` alongside the request,
dynamically extracting `io.jooby.Context` from the available transport.
* Updated `McpRouter` to register tools, prompts, resources, and completions
using clean lambda adapters that map the current server type (stateful vs.
stateless) to the unified handler.1 parent dcc65d3 commit 9532561
File tree
15 files changed
+1226
-356
lines changed- modules
- jooby-apt/src
- main/java/io/jooby/internal/apt
- test/java/tests/i3830
- jooby-mcp
- src/main/java/io/jooby
- internal/mcp
- mcp
- transport
- tests
- src/test/java/io/jooby/i3830
15 files changed
+1226
-356
lines changedLines changed: 32 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
138 | 138 | | |
139 | 139 | | |
140 | 140 | | |
| 141 | + | |
141 | 142 | | |
142 | 143 | | |
143 | 144 | | |
| |||
276 | 277 | | |
277 | 278 | | |
278 | 279 | | |
| 280 | + | |
279 | 281 | | |
280 | 282 | | |
281 | 283 | | |
| |||
431 | 433 | | |
432 | 434 | | |
433 | 435 | | |
| 436 | + | |
434 | 437 | | |
435 | 438 | | |
436 | 439 | | |
437 | 440 | | |
438 | 441 | | |
439 | 442 | | |
440 | | - | |
441 | | - | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
442 | 446 | | |
443 | 447 | | |
444 | 448 | | |
| |||
448 | 452 | | |
449 | 453 | | |
450 | 454 | | |
451 | | - | |
| 455 | + | |
| 456 | + | |
452 | 457 | | |
453 | 458 | | |
454 | 459 | | |
455 | 460 | | |
456 | 461 | | |
457 | 462 | | |
458 | 463 | | |
459 | | - | |
| 464 | + | |
460 | 465 | | |
| 466 | + | |
461 | 467 | | |
462 | 468 | | |
463 | 469 | | |
464 | 470 | | |
465 | 471 | | |
466 | 472 | | |
467 | | - | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
468 | 476 | | |
469 | 477 | | |
470 | 478 | | |
| |||
541 | 549 | | |
542 | 550 | | |
543 | 551 | | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
544 | 570 | | |
545 | 571 | | |
546 | 572 | | |
| |||
687 | 713 | | |
688 | 714 | | |
689 | 715 | | |
690 | | - | |
| 716 | + | |
691 | 717 | | |
692 | 718 | | |
693 | 719 | | |
| |||
0 commit comments