feat: Add selective registration to exclude specific tools from Redis and heartbeats

This commit is contained in:
jade
2026-07-07 13:00:14 +09:00
parent 0b0eb4884c
commit 3fe04a93d5
3 changed files with 10 additions and 0 deletions

View File

@@ -13,4 +13,7 @@ public @interface McpFunction {
// 추가: 해당 함수가 요구하는 비즈니스 파라미터(JSON 형태의 properties)를 정의 // 추가: 해당 함수가 요구하는 비즈니스 파라미터(JSON 형태의 properties)를 정의
String parameterSchema() default "{}"; String parameterSchema() default "{}";
// 추가: Redis 자동 등록 및 Heartbeat 대상 여부 제어
boolean register() default true;
} }

View File

@@ -18,5 +18,6 @@ public class McpProperties {
private String description; private String description;
private String prompt; private String prompt;
private String mappingId; private String mappingId;
private Boolean register;
} }
} }

View File

@@ -63,6 +63,12 @@ public class ToolRegistryHeartbeatSender {
prop = mcpProperties.getFunctions().get(functionAnnotation.name()); prop = mcpProperties.getFunctions().get(functionAnnotation.name());
} }
boolean isRegister = prop != null && prop.getRegister() != null ? prop.getRegister() : functionAnnotation.register();
if (!isRegister) {
log.info(" [HeartbeatSender] '{}' 툴은 설정에 의해 외부 등록(Redis) 대상에서 제외되었습니다.", functionAnnotation.name());
continue;
}
ToolMetadata meta = new ToolMetadata(); ToolMetadata meta = new ToolMetadata();
meta.setToolName(functionAnnotation.name()); meta.setToolName(functionAnnotation.name());
meta.setDescription(prop != null && prop.getDescription() != null ? prop.getDescription() : functionAnnotation.description()); meta.setDescription(prop != null && prop.getDescription() != null ? prop.getDescription() : functionAnnotation.description());