refactor: rename McpFunction attributes (subToolName -> name, parameterSchema -> inputSchema) and remove hardcoded API key

This commit is contained in:
jade
2026-07-11 01:13:20 +09:00
parent 1907743c79
commit d4232e6d7f
25 changed files with 37 additions and 42 deletions

View File

@@ -6,14 +6,14 @@ import java.lang.annotation.*;
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface McpFunction {
String name(); // 사람이 읽는 라벨 (예: "고객 조회 툴")
String subToolName(); // MCP 서브툴 명칭 (예: "customer_search")
String displayName(); // 사람이 읽는 라벨 (예: "고객 조회 툴")
String name(); // MCP 서브툴 명칭 (예: "customer_search")
String description();
String prompt() default "";
String mappingId() default "";
// 추가: 해당 함수가 요구하는 비즈니스 파라미터(JSON 형태의 properties)를 정의
String parameterSchema() default "{}";
String inputSchema() default "{}";
// 추가: Redis 자동 등록 및 Heartbeat 대상 여부 제어
boolean register() default true;

View File

@@ -80,8 +80,8 @@ public class ToolRegistryHeartbeatSender {
for (Method method : targetClass.getDeclaredMethods()) {
McpFunction functionAnnotation = AnnotationUtils.findAnnotation(method, McpFunction.class);
if (functionAnnotation != null) {
String baseName = functionAnnotation.name();
String rawSubToolName = functionAnnotation.subToolName();
String baseName = functionAnnotation.displayName();
String rawSubToolName = functionAnnotation.name();
String subToolName = mcpProperties.getNamespace() != null && !mcpProperties.getNamespace().isEmpty()
? mcpProperties.getNamespace() + "_" + rawSubToolName
: rawSubToolName;
@@ -144,7 +144,7 @@ public class ToolRegistryHeartbeatSender {
org.springframework.http.ResponseEntity<String> response = restClient.post()
.uri(gatewayUrl + "/mcp/api/v1/registry/heartbeat")
.header("Content-Type", "application/json")
.header("X-API-KEY", "SHINHAN_MCP_TEST_KEY_9999")
.body(tool.getUid())
.retrieve()
.toEntity(String.class);
@@ -164,7 +164,7 @@ public class ToolRegistryHeartbeatSender {
restClient.post()
.uri(gatewayUrl + "/mcp/api/v1/registry/register")
.header("Content-Type", "application/json")
.header("X-API-KEY", "SHINHAN_MCP_TEST_KEY_9999")
.body(tool)
.retrieve()
.toBodilessEntity();