feat: Add MCP Tool sample for template download
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
package io.shinhanlife.axhub.biz.mcp.tool.dto;
|
||||
|
||||
import lombok.AccessLevel;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.ToString;
|
||||
|
||||
@Getter
|
||||
@Builder
|
||||
@ToString
|
||||
@NoArgsConstructor(access = AccessLevel.PROTECTED)
|
||||
@AllArgsConstructor
|
||||
public class TemplateDownloadReq {
|
||||
|
||||
/**
|
||||
* 다운로드할 템플릿의 종류 ID (예: CUSTOMER_EXCEL, PRODUCT_PDF 등)
|
||||
*/
|
||||
private String templateId;
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package io.shinhanlife.axhub.biz.mcp.tool.service;
|
||||
|
||||
import io.shinhanlife.axhub.biz.mcp.tool.annotation.McpFunction;
|
||||
import io.shinhanlife.axhub.biz.mcp.tool.annotation.McpTool;
|
||||
import io.shinhanlife.axhub.biz.mcp.tool.dto.TemplateDownloadReq;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import java.util.Map;
|
||||
|
||||
@Slf4j
|
||||
@McpTool(
|
||||
routingType = "HTTP",
|
||||
group = "COMMON"
|
||||
)
|
||||
public class TemplateUtilityService extends AbstractMcpToolService {
|
||||
|
||||
@McpFunction(
|
||||
name = "get_template_file_url",
|
||||
description = "각종 양식(엑셀, PDF 등) 샘플 파일의 다운로드 URL을 제공합니다.",
|
||||
prompt = "고객 등록 엑셀 샘플 파일 다운로드 링크 줘.",
|
||||
mappingId = "COM_TMPL_01"
|
||||
)
|
||||
public Map<String, Object> getTemplateFileUrl(TemplateDownloadReq data) {
|
||||
log.info("MCP 툴 호출됨: get_template_file_url, 요청 템플릿 ID: {}", data.getTemplateId());
|
||||
|
||||
// 실제 운영 환경에서는 S3 URL이나 내부 파일 다운로드 API URL을 생성합니다.
|
||||
// 여기서는 샘플로 가짜(Dummy) URL을 반환합니다.
|
||||
String fileName = "sample_" + (data.getTemplateId() != null ? data.getTemplateId().toLowerCase() : "default") + ".xlsx";
|
||||
String downloadUrl = "https://axhub-file-server.shinhanlife.io/downloads/" + fileName;
|
||||
|
||||
return Map.of(
|
||||
"status", "success",
|
||||
"fileName", fileName,
|
||||
"downloadUrl", downloadUrl,
|
||||
"message", "다운로드 링크가 성공적으로 생성되었습니다. AI는 이 링크를 마크다운 형식으로 사용자에게 전달해야 합니다."
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user