build: validate duplicate MCP tool names before packaging
All checks were successful
Deploy to OCIWP / deploy (push) Successful in 2m1s
All checks were successful
Deploy to OCIWP / deploy (push) Successful in 2m1s
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
package io.shinhanlife.dap.lib.validation;
|
||||
|
||||
import java.nio.file.Path;
|
||||
|
||||
/** Gradle entry point for validating unique MCP Tool names before packaging. */
|
||||
public final class McpToolNameValidationRunner {
|
||||
|
||||
private McpToolNameValidationRunner() {
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
if (args.length != 1) {
|
||||
throw new IllegalArgumentException("Usage: McpToolNameValidationRunner <project-root>");
|
||||
}
|
||||
validate(Path.of(args[0]));
|
||||
}
|
||||
|
||||
static void validate(Path projectRoot) {
|
||||
McpToolNameValidator.assertUnique(projectRoot);
|
||||
}
|
||||
}
|
||||
@@ -42,6 +42,15 @@ class McpToolNameValidatorTest {
|
||||
assertTrue(exception.getMessage().contains("dap-tool-second"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void validationRunnerRejectsDuplicateMcpFunctionNamesBeforePackaging() throws IOException {
|
||||
writeToolSource("dap-tool-first", "FirstTool.java", "first", "send_sms");
|
||||
writeToolSource("dap-tool-second", "SecondTool.java", "second", "send_sms");
|
||||
|
||||
assertThrows(IllegalStateException.class,
|
||||
() -> McpToolNameValidationRunner.validate(temporaryRoot));
|
||||
}
|
||||
|
||||
@Test
|
||||
void acceptsCurrentProjectToolNames() {
|
||||
assertDoesNotThrow(() -> McpToolNameValidator.assertUnique(findProjectRoot()));
|
||||
|
||||
Reference in New Issue
Block a user