From 3216148ee21ee3a0255531f6c90bf7ec3e8ffc40 Mon Sep 17 00:00:00 2001 From: jade Date: Tue, 18 Aug 2026 20:51:41 +0900 Subject: [PATCH] feat(was-lib): add /tool-manifest/{categoryKey} endpoint for filtered manifest --- .../dap/lib/manifest/ToolManifestService.java | 5 +++++ .../mcc/presentation/ToolManifestController.java | 13 ++++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/dap-was-lib/src/main/java/io/shinhanlife/dap/lib/manifest/ToolManifestService.java b/dap-was-lib/src/main/java/io/shinhanlife/dap/lib/manifest/ToolManifestService.java index 5215ee99..27ace95e 100644 --- a/dap-was-lib/src/main/java/io/shinhanlife/dap/lib/manifest/ToolManifestService.java +++ b/dap-was-lib/src/main/java/io/shinhanlife/dap/lib/manifest/ToolManifestService.java @@ -43,12 +43,17 @@ public class ToolManifestService { } public ToolManifestResponse currentManifest() { + return currentManifest(null); + } + + public ToolManifestResponse currentManifest(String categoryKey) { String bundleId = properties.getManifest() == null ? null : properties.getManifest().getBundleId(); if (bundleId == null || bundleId.isBlank()) { throw new IllegalStateException("mcp.manifest.bundle-id must be configured"); } List tools = toolSupplier.get().stream() + .filter(tool -> categoryKey == null || categoryKey.equals(tool.getCategoryKey())) .map(this::toManifestItem) .sorted(Comparator.comparing(ToolManifestItem::name)) .toList(); diff --git a/dap-was-lib/src/main/java/io/shinhanlife/dap/mcc/presentation/ToolManifestController.java b/dap-was-lib/src/main/java/io/shinhanlife/dap/mcc/presentation/ToolManifestController.java index a8eeea7f..0d20f50b 100644 --- a/dap-was-lib/src/main/java/io/shinhanlife/dap/mcc/presentation/ToolManifestController.java +++ b/dap-was-lib/src/main/java/io/shinhanlife/dap/mcc/presentation/ToolManifestController.java @@ -8,6 +8,7 @@ import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestHeader; import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.PathVariable; /** Read-only Tool Service manifest endpoint for MCP background discovery. */ @RestController @@ -22,7 +23,17 @@ public class ToolManifestController { @GetMapping(value = "/tool-manifest", produces = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity getManifest( @RequestHeader(value = HttpHeaders.IF_NONE_MATCH, required = false) String ifNoneMatch) { - ToolManifestResponse manifest = toolManifestService.currentManifest(); + return handleManifest(toolManifestService.currentManifest(), ifNoneMatch); + } + + @GetMapping(value = "/tool-manifest/{categoryKey}", produces = MediaType.APPLICATION_JSON_VALUE) + public ResponseEntity getManifestByCategory( + @PathVariable("categoryKey") String categoryKey, + @RequestHeader(value = HttpHeaders.IF_NONE_MATCH, required = false) String ifNoneMatch) { + return handleManifest(toolManifestService.currentManifest(categoryKey), ifNoneMatch); + } + + private ResponseEntity handleManifest(ToolManifestResponse manifest, String ifNoneMatch) { String eTag = '"' + manifest.revision() + '"'; if (eTag.equals(ifNoneMatch)) { return ResponseEntity.status(304).eTag(eTag).build();