Skip to main content
Glama

copy_items

Copies multiple files or directories from specified sources to destinations in a TypeScript-based filesystem, using a defined array of source-destination pairs.

Instructions

Copy multiple specified files/directories.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
operationsYesArray of {source, destination} objects.

Implementation Reference

  • Main handler function `handleCopyItemsFunc` that orchestrates multiple copy operations: parses and validates input, maps to concurrent promises, awaits settled results, processes and sorts them by original order, and returns JSON stringified results.
    const handleCopyItemsFunc = async (args: unknown): Promise<McpToolResponse> => {
      const { operations } = parseAndValidateArgs(args);
    
      const copyPromises = operations.map((op) => processSingleCopyOperation({ op }));
      const settledResults = await Promise.allSettled(copyPromises);
    
      const outputResults = processSettledResults(settledResults, operations);
    
      // Sort results based on the original order
      const originalIndexMap = new Map(operations.map((op, i) => [op.source.replaceAll('\\', '/'), i]));
      outputResults.sort((a, b) => {
        const indexA = originalIndexMap.get(a.source) ?? Infinity;
        const indexB = originalIndexMap.get(b.source) ?? Infinity;
        return indexA - indexB;
      });
    
      return {
        content: [{ type: 'text', text: JSON.stringify(outputResults, undefined, 2) }],
      };
    };
  • Zod schemas: `CopyOperationSchema` for individual source/destination pairs and `CopyItemsArgsSchema` for the tool input (array of operations, min 1).
    export const CopyOperationSchema = z
      .object({
        source: z.string().describe('Relative path of the source.'),
        destination: z.string().describe('Relative path of the destination.'),
      })
      .strict();
    
    export const CopyItemsArgsSchema = z
      .object({
        operations: z
          .array(CopyOperationSchema)
          .min(1, { message: 'Operations array cannot be empty' })
          .describe('Array of {source, destination} objects.'),
      })
      .strict();
  • Tool definition `copyItemsToolDefinition` that registers the tool with name 'copy_items', description, input schema, and handler function.
    export const copyItemsToolDefinition = {
      name: 'copy_items',
      description: 'Copy multiple specified files/directories.',
      inputSchema: CopyItemsArgsSchema,
      handler: handleCopyItemsFunc,
    };
  • Import statement bringing in the copyItemsToolDefinition for registration.
    import { copyItemsToolDefinition } from './copy-items.js';
  • Inclusion of `copyItemsToolDefinition` in the `allToolDefinitions` array, serving as the central registration point for all handler tools.
    copyItemsToolDefinition,
Behavior2/5

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

With no annotations provided, the description carries full burden but offers minimal behavioral insight. It states the action ('copy') but doesn't disclose critical traits like whether it overwrites existing files at destinations, handles permissions or errors, requires specific access, or supports recursive copying for directories. This leaves significant gaps for safe and effective use.

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

Conciseness5/5

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

The description is extremely concise—a single sentence that directly states the tool's function without unnecessary words. It's front-loaded with the core action ('copy'), making it efficient for quick comprehension, though this brevity contributes to gaps in other dimensions.

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

Completeness2/5

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

Given the complexity of a file operation tool with no annotations and no output schema, the description is insufficient. It lacks details on behavior (e.g., overwrite rules, error handling), output format, or integration with siblings like 'list_files' for path validation. For a mutation tool in a filesystem context, more completeness is needed to guide the agent effectively.

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

Parameters3/5

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

Schema description coverage is 100%, so the schema fully documents the 'operations' parameter with its structure. The description adds no additional meaning beyond implying multiple items can be copied, which is already clear from the schema's array type. This meets the baseline for high schema coverage without enhancing parameter understanding.

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

Purpose4/5

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

The description clearly states the verb ('copy') and resource ('multiple specified files/directories'), making the purpose immediately understandable. However, it doesn't explicitly differentiate from sibling tools like 'move_items' or 'write_content', which would require mentioning that this creates duplicates rather than relocating or overwriting content.

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?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention scenarios like duplicating files for backup versus moving them with 'move_items', or how it differs from 'write_content' for creating new files. Without such context, the agent must infer usage from the tool name alone.

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

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/SylphxAI/filesystem-mcp'

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