refs #735: add few-shot NL2SQL MCP tool

This commit is contained in:
devmrko
2026-07-24 16:21:01 +09:00
parent da992ff524
commit e753027536
6 changed files with 142 additions and 11 deletions

View File

@@ -17,7 +17,10 @@ public record McpProperties(
String qaVectorSearchToolDescription,
String qaVectorStoreToolName,
String qaVectorStoreToolLabel,
String qaVectorStoreToolDescription
String qaVectorStoreToolDescription,
String fewShotNl2SqlToolName,
String fewShotNl2SqlToolLabel,
String fewShotNl2SqlToolDescription
) {
private static final String DEFAULT_TOOL_NAME = "oracle.select_ai.data_text2sql";
@@ -46,6 +49,13 @@ public record McpProperties(
private static final String DEFAULT_QA_VECTOR_STORE_TOOL_DESCRIPTION =
"검토된 Select AI 결과를 후속 Text2SQL 품질 향상용 예제 SQL로 저장합니다. "
+ "질문과 읽기 전용 답 SQL이 필요합니다.";
private static final String DEFAULT_FEW_SHOT_NL2SQL_TOOL_NAME =
"oracle.select_ai.smilegate_fewshot_nl2sql";
private static final String DEFAULT_FEW_SHOT_NL2SQL_TOOL_LABEL =
"Few-shot NL2SQL 실행";
private static final String DEFAULT_FEW_SHOT_NL2SQL_TOOL_DESCRIPTION =
"벡터 Few-shot 예제를 찾아 prompt에 반영하고, SHOWSQL로 생성한 읽기 전용 SQL을 실행합니다. "
+ "Few-shot 근거, 생성 SQL, 실행 결과를 함께 반환합니다.";
public String resolvedToolName() {
return requiredOrDefault(toolName, DEFAULT_TOOL_NAME);
@@ -99,6 +109,18 @@ public record McpProperties(
return requiredOrDefault(qaVectorStoreToolDescription, DEFAULT_QA_VECTOR_STORE_TOOL_DESCRIPTION);
}
public String resolvedFewShotNl2SqlToolName() {
return requiredOrDefault(fewShotNl2SqlToolName, DEFAULT_FEW_SHOT_NL2SQL_TOOL_NAME);
}
public String resolvedFewShotNl2SqlToolLabel() {
return requiredOrDefault(fewShotNl2SqlToolLabel, DEFAULT_FEW_SHOT_NL2SQL_TOOL_LABEL);
}
public String resolvedFewShotNl2SqlToolDescription() {
return requiredOrDefault(fewShotNl2SqlToolDescription, DEFAULT_FEW_SHOT_NL2SQL_TOOL_DESCRIPTION);
}
private String requiredOrDefault(String value, String fallback) {
return value == null || value.isBlank() ? fallback : value.trim();
}