Skip to main content
Glama
penguinszp001

mcp-server-demo

move_file

Move a file to a new location within the allowed file operations root directory. Specify the source and destination paths.

Instructions

Move a file from source_path to destination_path inside MCP_FILE_OPS_ROOT.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
source_pathYes
destination_pathYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The core handler function for the 'move_file' tool. It resolves source/destination paths within MCP_FILE_OPS_ROOT, validates the source exists, creates parent directories if needed, and uses shutil.move to perform the file move.
    @mcp.tool()
    def move_file(source_path: str, destination_path: str) -> str:
        """Move a file from source_path to destination_path inside MCP_FILE_OPS_ROOT."""
        source = _resolve_file_ops_path(source_path)
        destination = _resolve_file_ops_path(destination_path)
    
        if not source.is_file():
            raise ValueError(f"Source file does not exist: {source}")
    
        destination.parent.mkdir(parents=True, exist_ok=True)
        shutil.move(str(source), str(destination))
        return f"Moved file from {source} to {destination}"
  • server.py:119-119 (registration)
    The @mcp.tool() decorator registers the 'move_file' function as an MCP tool on the FastMCP server instance.
    @mcp.tool()
  • Helper function used by move_file to resolve and validate file system paths, ensuring they stay within the configured MCP_FILE_OPS_ROOT.
    def _resolve_file_ops_path(path: str | None = None) -> Path:
        if not FILE_OPS_ROOT:
            raise ValueError("MCP_FILE_OPS_ROOT is not configured in .env.")
    
        root = Path(FILE_OPS_ROOT).expanduser().resolve()
        root.mkdir(parents=True, exist_ok=True)
    
        target = root if path is None else (root / path).resolve()
        if target != root and root not in target.parents:
            raise ValueError("Path escapes the configured MCP_FILE_OPS_ROOT.")
        return target
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full burden. It only states 'move' but does not disclose whether overwrite occurs, permission changes, or error handling (e.g., if destination exists).

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Single sentence efficiently conveys core purpose. Could be slightly more structured (e.g., separate line for behavior), but overall concise.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Tool is simple (2 params, no nested objects). Description covers basic action but lacks safety info (overwrite behavior) and output details. Adequate but not thorough.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters1/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%. The description adds no parameter-level details beyond the field names, which are already self-evident from the tool name. For a simple tool, this is insufficient.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb 'move', resource 'file', and specifies the scope 'inside MCP_FILE_OPS_ROOT'. This distinguishes it from sibling tools like 'move_files_by_glob'.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No when-to-use or when-not-to-use guidance is provided. No prerequisites (e.g., source must exist, destination must not exist) are mentioned, leaving the agent to infer usage context.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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/penguinszp001/mcp-server-demo'

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