Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions src/main/presenter/mcpPresenter/inMemoryServers/filesystem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1027,12 +1027,18 @@ export class FileSystemServer {
if (!parsed.success) {
throw new Error(`Invalid arguments for move_files: ${parsed.error}`)
}
const destInfo = await this.getFileStats(parsed.data.destination)
const results = await Promise.all(
parsed.data.sources.map(async (source) => {
const validSourcePath = await this.validatePath(source)
const validDestPath = await this.validatePath(
path.join(parsed.data.destination, path.basename(source))
)
let validDestPath = ''
if (destInfo.isFile) {
validDestPath = await this.validatePath(parsed.data.destination)
} else {
validDestPath = await this.validatePath(
path.join(parsed.data.destination, path.basename(source))
)
}
try {
await fs.rename(validSourcePath, validDestPath)
return `Successfully moved ${source} to ${parsed.data.destination}`
Expand Down