Skip to main content
Glama
FutureAtoms

Agentic Control Framework (ACF)

by FutureAtoms

copy_file

Duplicate files by specifying source and destination paths to organize or back up data within the ACF environment.

Instructions

Copy file

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sourceYes
destinationYes

Implementation Reference

  • Actual implementation of the copy_file tool. Copies a file or directory recursively, with path validation, existence checks, and error handling.
    function copyFile(sourcePath, destinationPath, allowedDirs) {
      try {
        if (!sourcePath) {
          return { success: false, message: 'No source path provided' };
        }
    
        if (!destinationPath) {
          return { success: false, message: 'No destination path provided' };
        }
    
        if (!isPathAllowed(sourcePath, allowedDirs) || !isPathAllowed(destinationPath, allowedDirs)) {
          return { success: false, message: 'Access to source or destination path is not allowed' };
        }
    
        const resolvedSourcePath = path.resolve(sourcePath);
        const resolvedDestPath = path.resolve(destinationPath);
        
        // Check if source exists
        if (!fs.existsSync(resolvedSourcePath)) {
          return { success: false, message: `Source not found: ${sourcePath}` };
        }
    
        // Check if source is a directory or file
        const stats = fs.statSync(resolvedSourcePath);
        if (stats.isDirectory()) {
          // Create destination directory if it doesn't exist
          if (!fs.existsSync(resolvedDestPath)) {
            fs.mkdirSync(resolvedDestPath, { recursive: true });
          }
          
          // Copy directory contents recursively
          const items = fs.readdirSync(resolvedSourcePath);
          for (const item of items) {
            const srcItemPath = path.join(resolvedSourcePath, item);
            const destItemPath = path.join(resolvedDestPath, item);
            if (fs.statSync(srcItemPath).isDirectory()) {
              // Recursive call for subdirectories
              copyFile(srcItemPath, destItemPath, allowedDirs);
            } else {
              // Copy file
              fs.copyFileSync(srcItemPath, destItemPath);
            }
          }
        } else {
          // Ensure destination directory exists
          const destDir = path.dirname(resolvedDestPath);
          if (!fs.existsSync(destDir)) {
            fs.mkdirSync(destDir, { recursive: true });
          }
          
          // Copy file
          fs.copyFileSync(resolvedSourcePath, resolvedDestPath);
        }
    
        return {
          success: true,
          message: `Successfully copied ${sourcePath} to ${destinationPath}`,
          source: sourcePath,
          destination: destinationPath,
          type: stats.isDirectory() ? 'directory' : 'file'
        };
      } catch (error) {
        logger.error(`Error copying file: ${error.message}`);
        return { success: false, message: `Error copying file: ${error.message}` };
      }
  • Input schema for copy_file tool registration: defines 'source' and 'destination' as required string properties.
    { name:'copy_file', description:'Copy file'+(readonlyMode?' (RO)':''), inputSchema:{ type:'object', properties:{ source:{type:'string'}, destination:{type:'string'} }, required:['source','destination'] } },
  • Registration of copy_file tool in the tools/list handler, including description and input schema.
    { name:'copy_file', description:'Copy file'+(readonlyMode?' (RO)':''), inputSchema:{ type:'object', properties:{ source:{type:'string'}, destination:{type:'string'} }, required:['source','destination'] } },
  • Dispatch handler for copy_file - checks read-only mode then calls filesystemTools.copyFile.
    case 'copy_file':
      if (!checkReadOnly('copy_file')) { data = { success:false, message:'Operation not allowed: read-only mode' }; break; }
      data = filesystemTools.copyFile(args.source, args.destination, allowedDirectories);
      break;
  • Read-only check helper that lists 'copy_file' as a write operation, preventing execution in read-only mode.
    function checkReadOnly(toolName) {
      if (!readonlyMode) return true;
      const writes = ['write_file','copy_file','move_file','delete_file','create_directory'];
      return !writes.includes(toolName);
    }
Behavior1/5

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

No annotations provided, so description must bear full burden. It only says 'Copy file', disclosing no behavioral traits such as whether source must exist, whether destination is overwritten, or permissions needed. Scores 1: missing behavioral information.

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

Conciseness2/5

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

Extremely short but under-specified. While concise, it fails to convey essential info. The single sentence is a tautology and does not earn its place. Scores 2: under-specification, not concise in a helpful way.

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

Completeness1/5

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

Given 2 parameters, no output schema, no annotations, and sibling file tools, the description is wholly incomplete. It lacks context on path handling, overwrite behavior, error conditions, etc. Scores 1: inadequate completeness.

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% and description adds no meaning to parameters. It does not explain 'source' and 'destination' path formats, required nature, or behavior. Scores 1: no value added beyond schema.

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

Purpose2/5

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

Description 'Copy file' is a tautology of the tool name 'copy_file', providing no additional clarity. It does not distinguish from siblings like move_file or delete_file. It scores 2 per rubric: tautology (restates name/title).

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 guidance on when to use this tool versus alternatives (e.g., move_file vs copy_file). The description does not mention when to copy versus other file operations. Scores 2: no guidance.

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/FutureAtoms/agentic-control-framework'

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