Skip to content

Commit a0fc08f

Browse files
Merge pull request #1 from pragneshbagary/write_file
fix: handle write_file toolset issue (#4174)
2 parents e21b634 + 3c91f4f commit a0fc08f

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

pkg/mcp/toolset/filesystem.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
"io"
1010
"os"
1111
"path"
12+
"path/filepath"
1213

1314
"github.com/modelcontextprotocol/go-sdk/mcp"
1415

@@ -87,6 +88,11 @@ func (ts *ToolSet) WriteFile(_ context.Context,
8788
if err != nil {
8889
return nil, nil, err
8990
}
91+
dir := filepath.Dir(guestPath)
92+
err = ts.sftp.MkdirAll(dir)
93+
if err != nil {
94+
return nil, nil, err
95+
}
9096
f, err := ts.sftp.Create(guestPath)
9197
if err != nil {
9298
return nil, nil, err

0 commit comments

Comments
 (0)