Skip to main content
Glama
Preston-Harrison

Filesystem MCP Server

move_file

Move or rename files securely within allowed directory roots. Specify source and destination paths; tool creates parent directories if needed and ensures destination does not already exist.

Instructions

Move or rename a file from source to destination.

Args: src (str): Source file path (absolute or relative to allowed directories) dst (str): Destination file path (absolute or relative to allowed directories)

Returns: str: Success message with source and destination paths, or error message if failed

Note: - Both paths must be within allowed directory roots - Fails if destination already exists - Creates parent directories for destination if needed

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dstYes
srcYes

Implementation Reference

  • main.py:258-283 (handler)
    The move_file tool handler: decorated with @mcp.tool under read-only check, implements safe file move/rename using _resolve for path validation, creates parent dirs if needed, handles errors with _human_error.
    @mcp.tool def move_file(src: str, dst: str) -> str: """Move or rename a file from source to destination. Args: src (str): Source file path (absolute or relative to allowed directories) dst (str): Destination file path (absolute or relative to allowed directories) Returns: str: Success message with source and destination paths, or error message if failed Note: - Both paths must be within allowed directory roots - Fails if destination already exists - Creates parent directories for destination if needed """ try: src_p, dst_p = _resolve(src), _resolve(dst) if dst_p.exists(): return f"Error moving file: destination '{dst_p}' already exists" dst_p.parent.mkdir(parents=True, exist_ok=True) src_p.rename(dst_p) return f"Moved {src_p} → {dst_p}" except Exception as e: return _human_error(e, "moving file")

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Preston-Harrison/fs-mcp-py'

If you have feedback or need assistance with the MCP directory API, please join our Discord server