feat: Support manual execution of hidden tools via fallback routing

This commit is contained in:
jade
2026-07-08 16:09:45 +09:00
parent e8aabecc1a
commit 2b432c701a
4 changed files with 71 additions and 31 deletions

View File

@@ -2,6 +2,7 @@ package io.shinhanlife.axhub.biz.mcp.gateway.service;
import io.shinhanlife.axhub.common.mcp.security.SecurityProperties;
import io.shinhanlife.axhub.biz.mcp.gateway.registry.RedisRegistryService;
import io.shinhanlife.axhub.biz.mcp.gateway.dto.ToolMetadata;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
@@ -36,8 +37,17 @@ public class ToolPlanner {
var toolMetadata = redisRegistryService.getTool(toolName);
if (toolMetadata == null) {
log.warn(" [Planner] 등록되지 않은 툴 요청: {}", toolName);
throw new RuntimeException("해당 툴(" + toolName + ")이 레지스트리에 존재하지 않습니다.");
log.warn(" [Planner] 등록되지 않은 툴 요청: {}. 레지스트리를 참조하지 않고 강제 연동 모드로 전환합니다.", toolName);
// 히든 툴(register=false)에 대한 강제 라우팅 폴백
String fallbackPodUrl = "http://tool-other:8084"; // 기본값 (get_template_file_url 등)
if (toolName.contains("email")) fallbackPodUrl = "http://tool-email:8083";
else if (toolName.contains("sms")) fallbackPodUrl = "http://tool-sms:8082";
toolMetadata = ToolMetadata.builder()
.toolName(toolName)
.integrationType("DIRECT")
.podUrl(fallbackPodUrl)
.build();
}
// 2-1. [신규] 도메인 그룹핑 기반 권한 검증