refactor: UseCase 인터페이스 내 DTO 분리 및 강결합 제거
Some checks failed
Deploy to OCIWP / deploy (push) Has been cancelled

This commit is contained in:
jade
2026-07-27 10:04:56 +09:00
parent ded5ef9e8f
commit 2c64d86a56
5 changed files with 12 additions and 14 deletions

View File

@@ -1,7 +1,8 @@
package io.shinhanlife.dap.mcc.biz.smp.usecase;
import io.shinhanlife.dap.mcc.biz.smp.dto.*;
public interface DailyQuoteToolUseCase {
io.shinhanlife.dap.mcc.biz.smp.usecase.impl.DailyQuoteToolUseCaseImpl.DailyQuoteResponse execute(io.shinhanlife.dap.mcc.biz.smp.usecase.impl.DailyQuoteToolUseCaseImpl.DailyQuoteRequest req);
record DailyQuoteRequest(String category) {}
record DailyQuoteResponse(String quote, String author) {}
DailyQuoteResponse execute(DailyQuoteRequest req);
}

View File

@@ -1,7 +1,8 @@
package io.shinhanlife.dap.mcc.biz.smp.usecase;
import io.shinhanlife.dap.mcc.biz.smp.dto.*;
public interface ExchangeRateToolUseCase {
io.shinhanlife.dap.mcc.biz.smp.usecase.impl.ExchangeRateToolUseCaseImpl.ExchangeRateResponse execute(io.shinhanlife.dap.mcc.biz.smp.usecase.impl.ExchangeRateToolUseCaseImpl.ExchangeRateRequest req);
record ExchangeRateRequest(String currencyCode) {}
record ExchangeRateResponse(String baseCurrency, String targetCurrency, double rate) {}
ExchangeRateResponse execute(ExchangeRateRequest req);
}

View File

@@ -32,9 +32,6 @@ import java.util.Random;
)
public class DailyQuoteToolUseCaseImpl extends AbstractMcpToolUseCase implements DailyQuoteToolUseCase {
public record DailyQuoteRequest(String category) {}
public record DailyQuoteResponse(String quote, String author) {}
private final List<DailyQuoteResponse> quotes = List.of(
new DailyQuoteResponse("성공은 매일 반복한 작은 노력들의 합이다.", "로버트 콜리어"),
new DailyQuoteResponse("시작이 반이다.", "아리스토텔레스"),
@@ -42,6 +39,7 @@ public class DailyQuoteToolUseCaseImpl extends AbstractMcpToolUseCase implements
new DailyQuoteResponse("가장 큰 위험은 위험 없는 삶이다.", "스티븐 코비")
);
@Override
@McpFunction(register = false, displayName = "랜덤 명언 툴", name = "daily_quote",
description = "무작위로 영감을 주는 명언을 하나 가져옵니다.",
prompt = "오늘의 명언 하나 알려줘, 동기부여 명언 등",

View File

@@ -30,15 +30,13 @@ import org.springframework.web.client.RestClient;
)
public class ExchangeRateToolUseCaseImpl extends AbstractMcpToolUseCase implements ExchangeRateToolUseCase {
public record ExchangeRateRequest(String currencyCode) {}
public record ExchangeRateResponse(String baseCurrency, String targetCurrency, double rate) {}
private final RestClient restClient;
public ExchangeRateToolUseCaseImpl() {
this.restClient = RestClient.create();
}
@Override
@McpFunction(register = false, displayName = "실시간 환율 조회 툴", name = "exchange_rate",
description = "원하는 통화의 실시간 환율을 조회합니다. (예: USD, EUR, JPY)",
prompt = "현재 달러 환율 알려줘, 엔화 환율은?",

View File

@@ -20,8 +20,8 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.properties.ConfigurationPropertiesScan;
import org.springframework.cache.annotation.EnableCaching;
@SpringBootApplication(scanBasePackages = {"io.shinhanlife.dap.mcc", "io.shinhanlife.dap.lib.adapter", "io.shinhanlife.dap.lib.mcp", "io.shinhanlife.dap.lib.config", "io.shinhanlife.dap.lib.integration", "io.shinhanlife.dap.other"})
@ConfigurationPropertiesScan(basePackages = {"io.shinhanlife.dap.mcc", "io.shinhanlife.dap.lib.adapter", "io.shinhanlife.dap.lib.mcp", "io.shinhanlife.dap.lib.config", "io.shinhanlife.dap.lib.integration", "io.shinhanlife.dap.other"})
@SpringBootApplication(scanBasePackages = {"io.shinhanlife.dap.mcc", "io.shinhanlife.dap.lib.adapter", "io.shinhanlife.dap.lib.mcp", "io.shinhanlife.dap.lib.config", "io.shinhanlife.dap.lib.integration"})
@ConfigurationPropertiesScan(basePackages = {"io.shinhanlife.dap.mcc", "io.shinhanlife.dap.lib.adapter", "io.shinhanlife.dap.lib.mcp", "io.shinhanlife.dap.lib.config", "io.shinhanlife.dap.lib.integration"})
@EnableCaching
public class DapToolOthApplication {
public static void main(String[] args) {