forked from kimhyungsik/ax_hub_mcp_tool
fix: ToolScaffolder에서 입력받은 baseName을 PascalCase로 강제 변환하도록 수정 및 HrTest 파일 재생성
This commit is contained in:
@@ -81,6 +81,7 @@ public class ToolScaffolder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static String scaffold(String baseName, String interfaceId, String description, String group, String routingType, String moduleName, String author, String createDate, boolean register) throws IOException {
|
public static String scaffold(String baseName, String interfaceId, String description, String group, String routingType, String moduleName, String author, String createDate, boolean register) throws IOException {
|
||||||
|
baseName = toPascalCase(baseName);
|
||||||
String envSourceDir = System.getenv("AXHUB_SOURCE_DIR");
|
String envSourceDir = System.getenv("AXHUB_SOURCE_DIR");
|
||||||
Path rootDir = envSourceDir != null ? Paths.get(envSourceDir) : Paths.get(".");
|
Path rootDir = envSourceDir != null ? Paths.get(envSourceDir) : Paths.get(".");
|
||||||
|
|
||||||
@@ -224,4 +225,26 @@ public class ToolScaffolder {
|
|||||||
|
|
||||||
return log.toString();
|
return log.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static String toPascalCase(String str) {
|
||||||
|
if (str == null || str.isEmpty()) {
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
StringBuilder result = new StringBuilder();
|
||||||
|
boolean capitalizeNext = true;
|
||||||
|
for (char c : str.toCharArray()) {
|
||||||
|
if (c == '_' || c == '-' || c == ' ') {
|
||||||
|
capitalizeNext = true;
|
||||||
|
} else if (capitalizeNext) {
|
||||||
|
result.append(Character.toUpperCase(c));
|
||||||
|
capitalizeNext = false;
|
||||||
|
} else {
|
||||||
|
result.append(c);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (result.length() > 0) {
|
||||||
|
result.setCharAt(0, Character.toUpperCase(result.charAt(0)));
|
||||||
|
}
|
||||||
|
return result.toString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -5,20 +5,20 @@ import lombok.Data;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @package io.shinhanlife.axhub.biz.mcp.tool.dto
|
* @package io.shinhanlife.axhub.biz.mcp.tool.dto
|
||||||
* @className hr_testReq
|
* @className HrTestReq
|
||||||
* @description AX HUB 시스템 처리 클래스
|
* @description AX HUB 시스템 처리 클래스
|
||||||
* @author root
|
* @author system
|
||||||
* @create 2026.07.13
|
* @create 2026.07.13
|
||||||
* <pre>
|
* <pre>
|
||||||
* ---------- 개정이력 ----------
|
* ---------- 개정이력 ----------
|
||||||
* 수정일 수정자 수정내용
|
* 수정일 수정자 수정내용
|
||||||
* ---------- -------- ---------------------------
|
* ---------- -------- ---------------------------
|
||||||
* 2026.07.13 root 최초생성
|
* 2026.07.13 system 최초생성
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||||
public class hr_testReq {
|
public class HrTestReq {
|
||||||
// TODO: Add request fields here
|
// TODO: Add request fields here
|
||||||
}
|
}
|
||||||
@@ -5,21 +5,21 @@ import lombok.Data;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @package io.shinhanlife.axhub.biz.mcp.tool.dto
|
* @package io.shinhanlife.axhub.biz.mcp.tool.dto
|
||||||
* @className hr_testRes
|
* @className HrTestRes
|
||||||
* @description AX HUB 시스템 처리 클래스
|
* @description AX HUB 시스템 처리 클래스
|
||||||
* @author root
|
* @author system
|
||||||
* @create 2026.07.13
|
* @create 2026.07.13
|
||||||
* <pre>
|
* <pre>
|
||||||
* ---------- 개정이력 ----------
|
* ---------- 개정이력 ----------
|
||||||
* 수정일 수정자 수정내용
|
* 수정일 수정자 수정내용
|
||||||
* ---------- -------- ---------------------------
|
* ---------- -------- ---------------------------
|
||||||
* 2026.07.13 root 최초생성
|
* 2026.07.13 system 최초생성
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||||
public class hr_testRes {
|
public class HrTestRes {
|
||||||
private String status;
|
private String status;
|
||||||
private String message;
|
private String message;
|
||||||
// TODO: Add response fields here
|
// TODO: Add response fields here
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
package io.shinhanlife.axhub.biz.mcp.tool.hr.mapper;
|
||||||
|
|
||||||
|
import io.shinhanlife.axhub.biz.mcp.tool.dto.SmsSendReq;
|
||||||
|
import io.shinhanlife.axhub.biz.mcp.tool.sms.dto.SmsMciReqDto;
|
||||||
|
import org.mapstruct.Mapper;
|
||||||
|
import org.mapstruct.Mapping;
|
||||||
|
import org.mapstruct.factory.Mappers;
|
||||||
|
|
||||||
|
@Mapper(componentModel = "spring")
|
||||||
|
public interface HrMciMapper {
|
||||||
|
|
||||||
|
HrMciMapper INSTANCE = Mappers.getMapper(HrMciMapper.class);
|
||||||
|
|
||||||
|
@Mapping(source = "phoneNumber", target = "phone")
|
||||||
|
@Mapping(source = "message", target = "content")
|
||||||
|
SmsMciReqDto toMciReq(SmsSendReq req);
|
||||||
|
}
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
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.HrTestReq;
|
||||||
|
import io.shinhanlife.axhub.biz.mcp.tool.dto.HrTestRes;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @package io.shinhanlife.axhub.biz.mcp.tool.service
|
||||||
|
* @className HrTestService
|
||||||
|
* @description AX HUB 시스템 처리 클래스
|
||||||
|
* @author system
|
||||||
|
* @create 2026.07.13
|
||||||
|
* <pre>
|
||||||
|
* ---------- 개정이력 ----------
|
||||||
|
* 수정일 수정자 수정내용
|
||||||
|
* ---------- -------- ---------------------------
|
||||||
|
* 2026.07.13 system 최초생성
|
||||||
|
*
|
||||||
|
* </pre>
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@McpTool(
|
||||||
|
routingType = "HTTP",
|
||||||
|
categoryKey = "hr"
|
||||||
|
)
|
||||||
|
public class HrTestService extends AbstractMcpToolService {
|
||||||
|
|
||||||
|
@McpFunction(
|
||||||
|
displayName = "HrTest 툴",
|
||||||
|
name = "hrtest",
|
||||||
|
description = "인사 테스트",
|
||||||
|
prompt = "인사 테스트 해줘.",
|
||||||
|
mappingId = "HR_TEST",
|
||||||
|
register = true,
|
||||||
|
requiresApproval = false
|
||||||
|
)
|
||||||
|
public Object execute(HrTestReq req) {
|
||||||
|
return executeLegacy("HTTP", "HR_TEST", req);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,42 +0,0 @@
|
|||||||
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.hr_testReq;
|
|
||||||
import io.shinhanlife.axhub.biz.mcp.tool.dto.hr_testRes;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @package io.shinhanlife.axhub.biz.mcp.tool.service
|
|
||||||
* @className hr_testService
|
|
||||||
* @description AX HUB 시스템 처리 클래스
|
|
||||||
* @author root
|
|
||||||
* @create 2026.07.13
|
|
||||||
* <pre>
|
|
||||||
* ---------- 개정이력 ----------
|
|
||||||
* 수정일 수정자 수정내용
|
|
||||||
* ---------- -------- ---------------------------
|
|
||||||
* 2026.07.13 root 최초생성
|
|
||||||
*
|
|
||||||
* </pre>
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
@McpTool(
|
|
||||||
routingType = "MCI",
|
|
||||||
categoryKey = "common"
|
|
||||||
)
|
|
||||||
public class hr_testService extends AbstractMcpToolService {
|
|
||||||
|
|
||||||
@McpFunction(
|
|
||||||
displayName = "hr_test 툴",
|
|
||||||
name = "hr_test",
|
|
||||||
description = "hr 조회 합니다.",
|
|
||||||
prompt = "hr 조회 합니다. 해줘.",
|
|
||||||
mappingId = "HR_001",
|
|
||||||
register = false,
|
|
||||||
requiresApproval = false
|
|
||||||
)
|
|
||||||
public Object execute(hr_testReq req) {
|
|
||||||
return executeLegacy("MCI", "HR_001", req);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user