Fix mcp run script arg handling

This commit is contained in:
crschnick committed 2026-10-07 15:43:20 +00:00
1 parent dd4df43053
commit cdc35b35be
2 files changed
+12 -3

No files matched your search

@@ -123,6 +123,14 @@ public interface McpToolHandler
return b;
}
public Optional<FilePath> getOptionalFilePath(ShellControl sc, String key) throws Exception {
if (getOptionalStringArgument(key).isEmpty()) {
return Optional.empty();
}
return Optional.of(getFilePath(sc, key));
}
public FilePath getFilePath(ShellControl sc, String key) throws Exception {
var s = getStringArgument(key);
var path = FilePath.parse(s);
@@ -434,12 +434,13 @@ public final class McpTools {
.tool(tool)
.callHandler(McpToolHandler.of((req) -> {
var system = req.getStringArgument("system");
var script = req.getDataStoreRef("script");
var arguments = req.getStringArgument("arguments");
var script = req.getDataStoreRef(req.getStringArgument("script"));
var arguments = req.getOptionalStringArgument("arguments").orElse(null);
var shellStore = req.getShellStoreRef(system, true);
var shellSession = AppBeaconServer.get().getCache().getOrStart(shellStore);
var directory = req.getFilePath(shellSession.getControl(), "directory");
var directory = req.getOptionalFilePath(shellSession.getControl(), "directory")
.orElse(null);
var clazz = Class.forName(
AppExtensionManager.getInstance()