refactor: remove retryEnabled from tool metadata

This commit is contained in:
jade
2026-08-31 10:12:31 +09:00
parent 6a6592f2d5
commit 8b9bd4de16
12 changed files with 4 additions and 20 deletions

View File

@@ -30,7 +30,6 @@ public @interface GrowToolHint {
String inputSchemaResource() default "";
String outputSchemaResource() default "";
long timeoutMillis() default 5000L;
boolean retryEnabled() default true;
int retryMaxAttempts() default 3;
// Meta 정보 추가 (보고용 샘플)

View File

@@ -7,7 +7,6 @@ import java.util.List;
public record ToolManifestMeta(
String version,
long timeoutMillis,
boolean retryEnabled,
int retryMaxAttempts,
boolean enabled,
List<String> exampleQueries,

View File

@@ -22,7 +22,6 @@ import org.springframework.stereotype.Service;
public class ToolManifestService {
private static final long DEFAULT_TIMEOUT_MILLIS = 5000L;
private static final boolean DEFAULT_RETRY_ENABLED = true;
private static final int DEFAULT_RETRY_MAX_ATTEMPTS = 3;
private static final AtomicLong LAST_ISSUED_REVISION = new AtomicLong();
private final Supplier<List<ToolMetadata>> toolSupplier;
@@ -91,7 +90,6 @@ public class ToolManifestService {
isTrue(tool.getIdempotentHint()), isTrue(tool.getOpenWorldHint())),
new ToolManifestMeta(defaultString(tool.getSemver(), "1.0.0"),
positiveOrDefault(tool.getTimeoutMillis(), DEFAULT_TIMEOUT_MILLIS),
tool.getRetryEnabled() == null ? DEFAULT_RETRY_ENABLED : tool.getRetryEnabled(),
positiveOrDefault(tool.getRetryMaxAttempts(), DEFAULT_RETRY_MAX_ATTEMPTS),
tool.getEnabled() == null || tool.getEnabled(),
defaultList(tool.getExampleQueries()), defaultList(tool.getTags()),

View File

@@ -41,7 +41,6 @@ public final class ToolMetadataMcpMapper {
put(meta, "required_env_keys", metadata.getRequiredEnvKeys());
put(meta, "owner_org", metadata.getOwnerOrg());
meta.put("timeoutMillis", positiveOrDefault(metadata.getTimeoutMillis(), 5000L));
meta.put("retryEnabled", metadata.getRetryEnabled() == null || metadata.getRetryEnabled());
meta.put("retryMaxAttempts", positiveOrDefault(metadata.getRetryMaxAttempts(), 3));
return Map.copyOf(meta);
}

View File

@@ -131,7 +131,6 @@ public class ToolRegistryHeartbeatSender {
meta.setName(subToolName);
meta.setSemver("1.0.0");
meta.setTimeoutMillis(hintAnnotation == null ? 5000L : positiveOrDefault(hintAnnotation.timeoutMillis(), 5000L));
meta.setRetryEnabled(hintAnnotation == null || hintAnnotation.retryEnabled());
meta.setRetryMaxAttempts(hintAnnotation == null ? 3 : positiveOrDefault(hintAnnotation.retryMaxAttempts(), 3));
meta.setEnabled(true);
meta.setDescription(functionAnnotation.description());
@@ -327,4 +326,4 @@ public class ToolRegistryHeartbeatSender {
*/
private record ToolAnnotationMetadata(McpTool mcpTool, GrowToolHint growToolHint) {
}
}
}

View File

@@ -233,7 +233,6 @@ public class ToolScaffolder {
.append(" requiresApproval = ").append(isMutation).append(",\n")
.append(" categoryKey = \"").append(tool.group().toLowerCase(Locale.ROOT)).append("\",\n")
.append(" timeoutMillis = 5000L,\n")
.append(" retryEnabled = true,\n")
.append(" retryMaxAttempts = 3,\n");
if (tool.interfaceId() != null && !tool.interfaceId().isBlank()) {
methods.append(" mappingId = \"").append(javaText(tool.interfaceId())).append("\",\n");
@@ -388,7 +387,6 @@ public class ToolScaffolder {
.append(" requiresApproval = ").append(isMutation).append(",\n")
.append(" categoryKey = \"").append(tool.group().toLowerCase(Locale.ROOT)).append("\",\n")
.append(" timeoutMillis = 5000L,\n")
.append(" retryEnabled = true,\n")
.append(" retryMaxAttempts = 3,\n");
String mappingId = option(tool.interfaceId(), tool.httpApiName());
if (mappingId != null && !mappingId.isBlank()) {
@@ -773,7 +771,6 @@ public class ToolScaffolder {
sb.append(" requiresApproval = ").append(isMutation).append(",\n");
sb.append(" categoryKey = \"").append(group.toLowerCase(Locale.ROOT)).append("\",\n");
sb.append(" timeoutMillis = 5000L,\n");
sb.append(" retryEnabled = true,\n");
sb.append(" retryMaxAttempts = 3,\n");
if (interfaceId != null && !interfaceId.isBlank()) {
sb.append(" mappingId = \"").append(interfaceId).append("\",\n");

View File

@@ -121,8 +121,6 @@ public class ToolMetadata {
@Builder.Default
private OperationType operationType = OperationType.READ;
@Builder.Default
private Boolean retryEnabled = true;
@Builder.Default
private Integer retryMaxAttempts = 3;

View File

@@ -9,7 +9,6 @@ class GrowToolHintTest {
@Test
void exposesResilienceDefaults() throws Exception {
assertEquals(5000L, GrowToolHint.class.getMethod("timeoutMillis").getDefaultValue());
assertEquals(true, GrowToolHint.class.getMethod("retryEnabled").getDefaultValue());
assertEquals(3, GrowToolHint.class.getMethod("retryMaxAttempts").getDefaultValue());
}
}

View File

@@ -35,7 +35,6 @@ class ToolManifestServiceTest {
assertTrue(item.annotations().readOnlyHint());
assertEquals("1.2.0", item.meta().version());
assertEquals(3000, item.meta().timeoutMillis());
assertEquals(false, item.meta().retryEnabled());
assertEquals(5, item.meta().retryMaxAttempts());
assertEquals(List.of("계약 상태를 알려줘", "내 계약을 조회해줘", "계약번호로 찾아줘"),
item.meta().exampleQueries());
@@ -97,7 +96,6 @@ class ToolManifestServiceTest {
"required", List.of("contractNo"), "additionalProperties", false))
.semver(version)
.timeoutMillis(timeoutMillis)
.retryEnabled(false)
.retryMaxAttempts(5)
.enabled(true)
.readOnlyHint(true)

View File

@@ -1,6 +1,7 @@
package io.shinhanlife.dat.lib.mcp;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import io.shinhanlife.dat.mcc.dto.ToolMetadata;
import java.util.Map;
@@ -12,14 +13,13 @@ class ToolMetadataMcpMapperTest {
void exposesResilienceSettingsInMcpToolMeta() {
ToolMetadata metadata = ToolMetadata.builder()
.timeoutMillis(12000L)
.retryEnabled(false)
.retryMaxAttempts(5)
.build();
Map<String, Object> meta = ToolMetadataMcpMapper.meta(metadata);
assertEquals(12000L, meta.get("timeoutMillis"));
assertEquals(false, meta.get("retryEnabled"));
assertFalse(meta.containsKey("retryEnabled"));
assertEquals(5, meta.get("retryMaxAttempts"));
}
}

View File

@@ -57,7 +57,6 @@ class ToolRegistryHeartbeatSenderTest {
var metadata = sender.getAllScannedTools().getFirst();
assertThat(metadata.getTimeoutMillis()).isEqualTo(12000L);
assertThat(metadata.getRetryEnabled()).isFalse();
assertThat(metadata.getRetryMaxAttempts()).isEqualTo(1);
}
@@ -100,7 +99,7 @@ class ToolRegistryHeartbeatSenderTest {
static class SampleTool {
@McpTool(name = "test_sample_tool")
@GrowToolHint(timeoutMillis = 12000L, retryEnabled = false, retryMaxAttempts = 1)
@GrowToolHint(timeoutMillis = 12000L, retryMaxAttempts = 1)
void execute() {
}
}

View File

@@ -147,7 +147,6 @@ class ToolScaffolderTest {
assertTrue(useCase.contains("name = \"smp_employee_search\""), useCase);
assertTrue(useCase.contains("timeoutMillis = 5000L"), useCase);
assertTrue(useCase.contains("retryEnabled = true"), useCase);
assertTrue(useCase.contains("retryMaxAttempts = 3"), useCase);
assertTrue(useCase.contains("whenToUse = \"사용자가 이 업무 기능의 실행 또는 조회를 요청할 때 사용합니다.\""), useCase);
assertTrue(useCase.contains("exampleQueries = {\"직원 조회 정보를 보여줘\""), useCase);