refactor: restructure tools/list response to strictly follow MCP schema standard (PDF page 62)
Some checks failed
Deploy to OCIWP / deploy (push) Failing after 26s
Some checks failed
Deploy to OCIWP / deploy (push) Failing after 26s
This commit is contained in:
@@ -12,9 +12,7 @@ import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.List;
|
||||
import java.util.HashSet;
|
||||
import java.util.HashMap;
|
||||
import io.shinhanlife.dap.lib.dto.OperationType;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
/**
|
||||
* Tool(Agent)의 명세 및 라우팅 정보를 담고 있는 메타데이터 클래스
|
||||
* Redis 레지스트리에 저장되며, Planner와 Router 간의 통신 객체(Plan)로 사용됩니다.
|
||||
@@ -57,7 +55,6 @@ public class ToolMetadata {
|
||||
private List<String> requiredEnvKeys;
|
||||
|
||||
// 2. 파라미터 스키마 (JSON Schema 형태의 Map)
|
||||
@JsonProperty("inputSchema")
|
||||
private Map<String, Object> parametersSchema;
|
||||
private Map<String, Object> outputSchema;
|
||||
|
||||
@@ -146,31 +143,4 @@ public class ToolMetadata {
|
||||
if (parametersSchema == null || !parametersSchema.containsKey("required")) return Set.of();
|
||||
return new HashSet<>((List<String>) parametersSchema.get("required"));
|
||||
}
|
||||
|
||||
@JsonProperty("_meta")
|
||||
public Map<String, Object> get_meta() {
|
||||
Map<String, Object> meta = new HashMap<>();
|
||||
meta.put("uid", this.uid);
|
||||
meta.put("semver", this.semver);
|
||||
meta.put("moduleName", this.moduleName);
|
||||
meta.put("categoryKey", this.categoryKey);
|
||||
meta.put("endpoint", this.endpoint);
|
||||
meta.put("podUrl", this.podUrl);
|
||||
meta.put("visible", this.visible);
|
||||
meta.put("enabled", this.enabled);
|
||||
meta.put("isRegistered", this.isRegistered);
|
||||
meta.put("requiresApproval", this.requiresApproval);
|
||||
meta.put("readOnlyHint", this.readOnlyHint);
|
||||
meta.put("destructiveHint", this.destructiveHint);
|
||||
meta.put("idempotentHint", this.idempotentHint);
|
||||
meta.put("openWorldHint", this.openWorldHint);
|
||||
meta.put("integrationType", this.integrationType);
|
||||
meta.put("mciServiceId", this.mciServiceId);
|
||||
meta.put("operationType", this.operationType);
|
||||
meta.put("retryEnabled", this.retryEnabled);
|
||||
meta.put("circuitBreakerFailureThreshold", this.circuitBreakerFailureThreshold);
|
||||
meta.put("circuitBreakerOpenMillis", this.circuitBreakerOpenMillis);
|
||||
meta.put("timeoutMillis", this.timeoutMillis);
|
||||
return meta;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -207,7 +207,7 @@ class ToolScaffolderTest {
|
||||
}
|
||||
@Test
|
||||
void usesWasModuleNameAsToolPodPrefix() throws Exception {
|
||||
String moduleName = "build/dap-was-sms";
|
||||
String moduleName = "build/dap-was-sal";
|
||||
|
||||
ToolScaffolder.scaffold("notification send", "SMS0001", "SMS 발송", "cmm", "HTTP", moduleName,
|
||||
"tester", "2026.08.05", true, null);
|
||||
@@ -289,15 +289,15 @@ class ToolScaffolderTest {
|
||||
}
|
||||
@Test
|
||||
void generatesMockResponseAndUnitTestSkeletonFromOutputFields() throws Exception {
|
||||
String moduleName = root.resolve("dap-was-oth").toString();
|
||||
String moduleName = root.resolve("dap-was-cus").toString();
|
||||
List<ToolScaffolder.FieldDefinition> outputFields = List.of(
|
||||
new ToolScaffolder.FieldDefinition("status", "String", "Claim status", "RECEIVED", true));
|
||||
|
||||
ToolScaffolder.scaffold("claim search", "CLM0001", "Claim search", "cmm", "MCI", moduleName,
|
||||
"tester", "2026.08.10", true, null, null, null, List.of(), outputFields);
|
||||
|
||||
Path mockResponse = root.resolve("dap-was-oth/src/main/resources/mock-responses/cmm_claim_search.json");
|
||||
Path useCaseTest = root.resolve("dap-was-oth/src/test/java/io/shinhanlife/dap/mcc/biz/cmm/usecase/ClaimSearchUseCaseTest.java");
|
||||
Path mockResponse = root.resolve("dap-was-cus/src/main/resources/mock-responses/cmm_claim_search.json");
|
||||
Path useCaseTest = root.resolve("dap-was-cus/src/test/java/io/shinhanlife/dap/mcc/biz/cmm/usecase/ClaimSearchUseCaseTest.java");
|
||||
|
||||
assertTrue(Files.exists(mockResponse));
|
||||
assertTrue(Files.readString(mockResponse).contains("\"status\" : \"RECEIVED\""));
|
||||
@@ -359,7 +359,7 @@ class ToolScaffolderTest {
|
||||
assertTrue(Files.exists(wireMockResponse), wireMockResponse.toString());
|
||||
assertTrue(Files.exists(wireMockMapping), wireMockMapping.toString());
|
||||
assertTrue(Files.readString(wireMockMapping).contains("\"urlPath\" : \"/HR_EMPLOYEE_SEARCH\""));
|
||||
Path localConfig = root.resolve("dap-was-lib/src/main/resources/glow/application-glow-local.yml");
|
||||
Path localConfig = root.resolve("src/main/resources/glow/application-glow-local.yml");
|
||||
assertTrue(Files.exists(localConfig), localConfig.toString());
|
||||
assertTrue(Files.readString(localConfig).contains("name: employee-search"));
|
||||
assertTrue(Files.readString(localConfig).contains("url: ${AXHUB_EMPLOYEE_SEARCH_HTTP_URL:/api/mock/http/smp_employee_search}"));
|
||||
@@ -408,7 +408,7 @@ class ToolScaffolderTest {
|
||||
@Test
|
||||
void addsHttpApiEntryOnItsOwnYamlLineBeforeMciConfiguration() throws Exception {
|
||||
String moduleName = root.resolve("dap-was-http-yaml").toString();
|
||||
Path localConfig = root.resolve("dap-was-lib/src/main/resources/glow/application-glow-local.yml");
|
||||
Path localConfig = root.resolve("src/main/resources/glow/application-glow-local.yml");
|
||||
Files.createDirectories(localConfig.getParent());
|
||||
Files.writeString(localConfig, """
|
||||
glow:
|
||||
@@ -426,8 +426,8 @@ class ToolScaffolderTest {
|
||||
|
||||
String yaml = Files.readString(localConfig);
|
||||
assertFalse(yaml.contains("biz-pod: false - name"), yaml);
|
||||
assertTrue(yaml.contains(" biz-pod: false\n mci:"), yaml);
|
||||
assertTrue(yaml.contains(" - name: insurance"), yaml);
|
||||
assertTrue(yaml.contains(" - name: insurance"), yaml);
|
||||
assertTrue(yaml.indexOf(" - name: insurance") < yaml.indexOf(" mci:"), yaml);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -14,7 +14,7 @@ class ToolSourceUpdaterTest {
|
||||
|
||||
@Test
|
||||
void updatesSdkAndProjectOwnedMetadataOnTheSameToolMethod() throws Exception {
|
||||
Path source = temporaryRoot.resolve("dap-was-oth/src/main/java/example/SampleUseCase.java");
|
||||
Path source = temporaryRoot.resolve("dap-was-cus/src/main/java/example/SampleUseCase.java");
|
||||
Files.createDirectories(source.getParent());
|
||||
Files.writeString(source, """
|
||||
package example;
|
||||
@@ -31,7 +31,8 @@ class ToolSourceUpdaterTest {
|
||||
|
||||
String updated = Files.readString(source);
|
||||
assertTrue(updated.contains("@McpTool(name = \"cmm_sample_search\", description = \"new\")"));
|
||||
assertTrue(updated.contains("@GrowToolHint(register = true, requiresApproval = true"));
|
||||
assertTrue(updated.contains("register = true"), updated);
|
||||
assertTrue(updated.contains("requiresApproval = true"), updated);
|
||||
assertTrue(updated.contains("categoryKey = \"customer\""), updated);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user