feat: Add MCI Scaffolding support and fix bean collision
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
package io.shinhanlife.dap.biz.mcp.gateway.sync;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
|
||||
class DynamicMcpControllerRouteTest {
|
||||
|
||||
@Test
|
||||
void exposesOnlySupportedCategoryAwareMcpRoutes() {
|
||||
Set<String> getPaths = Arrays.stream(DynamicMcpController.class.getDeclaredMethods())
|
||||
.flatMap(method -> Arrays.stream(method.getAnnotationsByType(GetMapping.class)))
|
||||
.flatMap(mapping -> Arrays.stream(mapping.value()))
|
||||
.collect(Collectors.toSet());
|
||||
Set<String> postPaths = Arrays.stream(DynamicMcpController.class.getDeclaredMethods())
|
||||
.flatMap(method -> Arrays.stream(method.getAnnotationsByType(PostMapping.class)))
|
||||
.flatMap(mapping -> Arrays.stream(mapping.value()))
|
||||
.collect(Collectors.toSet());
|
||||
|
||||
assertTrue(getPaths.contains("/mcp/sse/{category}"));
|
||||
assertTrue(postPaths.contains("/mcp/message/{category}"));
|
||||
assertTrue(postPaths.contains("/mcp/custom/{category}"));
|
||||
assertFalse(postPaths.contains("/mcp"));
|
||||
assertFalse(postPaths.contains("/mcp/initialize"));
|
||||
assertFalse(postPaths.contains("/mcp/sse/initialize"));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package io.shinhanlife.dap.biz.mcp.gateway.sync;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import io.modelcontextprotocol.spec.McpSchema;
|
||||
import io.shinhanlife.dap.biz.mcp.gateway.dto.ToolMetadata;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
class RegistryMcpToolSpecificationFactoryTest {
|
||||
|
||||
@Test
|
||||
void exposesMetadataBehaviorHintsInMcpToolSpecification() {
|
||||
ToolMetadata metadata = ToolMetadata.builder()
|
||||
.name("customer_lookup")
|
||||
.description("Looks up customer information")
|
||||
.readOnlyHint(true)
|
||||
.destructiveHint(false)
|
||||
.idempotentHint(true)
|
||||
.openWorldHint(false)
|
||||
.build();
|
||||
|
||||
RegistryMcpToolSpecificationFactory factory = new RegistryMcpToolSpecificationFactory(null, new ObjectMapper());
|
||||
McpSchema.Tool tool = factory.create(metadata).tool();
|
||||
|
||||
assertTrue(tool.annotations().readOnlyHint());
|
||||
assertFalse(tool.annotations().destructiveHint());
|
||||
assertTrue(tool.annotations().idempotentHint());
|
||||
assertFalse(tool.annotations().openWorldHint());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user