From 285d4ce743149af46fa57faed0a4372c4dbea285 Mon Sep 17 00:00:00 2001 From: Ratnesh Maurya <85143283+ratnesh-maurya@users.noreply.github.com> Date: Mon, 23 Feb 2026 01:19:15 +0530 Subject: [PATCH] Make tool entrypoint relative to WorkDir Prefix discovered tool Entrypoint with "tools" (via filepath.Join) before creating the custom tool so execution from the agent root can find the file. A copy of the discovered tool is modified to avoid mutating the original, then passed to NewCustomTool. --- forge-cli/runtime/runner.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/forge-cli/runtime/runner.go b/forge-cli/runtime/runner.go index acc03e5..f415884 100644 --- a/forge-cli/runtime/runner.go +++ b/forge-cli/runtime/runner.go @@ -130,7 +130,10 @@ func (r *Runner) Run(ctx context.Context) error { discovered := clitools.DiscoverTools(toolsDir) cmdExec := &clitools.OSCommandExecutor{} for _, dt := range discovered { - ct := tools.NewCustomTool(dt, cmdExec) + // Entrypoint must be relative to WorkDir so execution from agent root finds the file + dtCopy := dt + dtCopy.Entrypoint = filepath.Join("tools", dt.Entrypoint) + ct := tools.NewCustomTool(dtCopy, cmdExec) if regErr := reg.Register(ct); regErr != nil { r.logger.Warn("failed to register custom tool", map[string]any{ "tool": dt.Name, "error": regErr.Error(),