Skip to main content
Glama
getmasv

masv

Official

transfer_files_from_integration

Move files from cloud integrations (AWS S3, Azure, Dropbox) or storage gateway into a new MASV package. Provide integration ID, file IDs, and package name to start the transfer.

Instructions

Transfer files from a cloud integration (AWS S3, Azure, Dropbox, etc.) or MASV Storage Gateway to MASV. Creates a new package and initiates the transfer. Use list_files_on_integration first to get file information including IDs.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
integrationIdYesID of the cloud or storage gateway integration
filesYesArray of files/directories to transfer from the integration
packageNameYesName for the new package
packageDescriptionNoDescription for the package
recipientsNoEmail addresses to send package to
notifyEmailNoEmail to notify on transfer completion
accessLimitNoDownload access limit (default: 5)

Implementation Reference

  • Zod schema definition for TransferFilesFromIntegration input validation. Defines fields: integrationId, files (array of TransferFileSchema), packageName, packageDescription, recipients, notifyEmail, accessLimit.
    const TransferFilesFromIntegrationSchema = z.object({
      integrationId: z.string().describe("ID of the cloud or storage gateway integration"),
      files: z.array(TransferFileSchema).min(1).describe("Array of files/directories to transfer from the integration"),
      packageName: z.string().describe("Name for the new package"),
      packageDescription: z.string().optional().describe("Description for the package"),
      recipients: z.array(z.email()).optional().describe("Email addresses to send package to"),
      notifyEmail: z.email().optional().describe("Email to notify on transfer completion"),
      accessLimit: z.number().optional().describe("Download access limit (default: 5)"),
    });
  • Main handler function transferFilesFromIntegration. Steps: (1) Gets integration provider details, (2) Creates a new package via MASV API, (3) Initiates a cloud-to-MASV transfer with the selected files, (4) Formats a human-readable response summarizing the transfer result.
    async function transferFilesFromIntegration({
      integrationId,
      files,
      packageName,
      packageDescription = "",
      recipients = [],
      notifyEmail,
      accessLimit = 5,
    }: TransferFilesFromIntegrationParams) {
      // Step 1: Get integration details to extract provider
      const integration = await getIntegration(integrationId);
      const provider = integration.provider;
    
      // Step 2: Create package
      const createPackageUrl = new URL(
        `${MASV_BASE_URL}/v1/teams/${MASV_TEAM_ID}/packages`,
      );
    
      const createPackageBody = {
        name: packageName,
        description: packageDescription,
        recipients: recipients,
        access_limit: accessLimit,
      };
    
      const createPackageHeaders = {
        "content-type": "application/json",
        "x-api-key": MASV_API_KEY,
      };
    
      const createPackageResponse = await fetch(createPackageUrl.toString(), {
        method: "POST",
        headers: createPackageHeaders,
        body: JSON.stringify(createPackageBody),
      });
    
      const packageData = await createPackageResponse.json();
    
      if (!createPackageResponse.ok) {
        throw new Error(`Failed to create package: ${JSON.stringify(packageData)}`);
      }
    
      const packageId = packageData.id;
      const packageToken = packageData.access_token;
    
      // Step 3: Initiate transfer
      const transferUrl = new URL(
        `${MASV_BASE_URL}/v1/packages/${packageId}/transfer`,
      );
    
      const transferBody = {
        cloud_connection_id: integrationId,
        direction: "cloud_to_masv",
        provider: provider,
        files: files,
        ...(notifyEmail && { notify_email: notifyEmail }),
      };
    
      const transferHeaders = {
        "content-type": "application/json",
        "x-package-token": packageToken,
      };
    
      const transferResponse = await fetch(transferUrl.toString(), {
        method: "POST",
        headers: transferHeaders,
        body: JSON.stringify(transferBody),
      });
    
      const transferData = await transferResponse.json();
    
      if (!transferResponse.ok) {
        throw new Error(`Failed to initiate transfer: ${JSON.stringify(transferData)}`);
      }
    
      // Step 4: Format response for LLM
      const fileCount = files.length;
    
      const fileList = files.slice(0, 10).map(file => {
        if (file.kind === "directory") {
          return `[DIR] ${file.name}/`;
        } else {
          return `[FILE] ${file.name}`;
        }
      });
    
      if (files.length > 10) {
        fileList.push(`... and ${files.length - 10} more items`);
      }
    
      const response = [
        "Transfer initiated successfully!",
        "",
        `Package: ${packageName}`,
        `Package ID: ${packageId}`,
        `Transfer ID: ${transferData.id}`,
        `Status: ${transferData.state}`,
        "",
        `Files being transferred (${fileCount} items):`,
        ...fileList,
        "",
        "Track progress:",
        `- Use get_activities tool with package_id: ${packageId}`,
        `- Use get_package tool with package_id: ${packageId}`,
        "- Or track progress in MASV web application",
      ].join("\n");
    
      return response;
    }
  • src/index.ts:298-314 (registration)
    Registers the 'transfer_files_from_integration' tool on the MCP server with description, schema reference, and handler that calls transferFilesFromIntegration and returns success/error.
    server.registerTool(
      "transfer_files_from_integration",
      {
        description:
          "Transfer files from a cloud integration (AWS S3, Azure, Dropbox, etc.) or MASV Storage Gateway to MASV. Creates a new package and initiates the transfer. Use list_files_on_integration first to get file information including IDs.",
        inputSchema: TransferFilesFromIntegrationSchema.shape,
      },
      async (args) => {
        try {
          const data = await transferFilesFromIntegration(args);
    
          return mcpOk(data);
        } catch (error) {
          return mcpError(error);
        }
      },
    );
  • TransferFileSchema - a supporting schema for individual file/directory objects used within the files array parameter.
    const TransferFileSchema = z.object({
      id: z.string().describe("File ID, for Storage Gateway it is full file path (path + filename)"),
      name: z.string().describe("File or directory name"),
      kind: z.enum(["file", "directory"]).describe("Type of item: file or directory"),
    });
  • TypeScript type inferred from the TransferFilesFromIntegrationSchema for type safety.
    type TransferFilesFromIntegrationParams = z.infer<
      typeof TransferFilesFromIntegrationSchema
    >;
Behavior3/5

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

With no annotations, the description must disclose behavior. It states that the tool 'creates a new package' and 'initiates the transfer', indicating a write operation and implying asynchronous initiation. However, it does not detail side effects (e.g., whether source files are deleted), idempotency, or how to monitor completion. This is adequate but not rich.

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 consists of two succinct sentences. The first states the core purpose, and the second provides a critical usage tip. No unnecessary words or redundancy; every sentence earns its place.

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

Completeness4/5

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

Given the complexity (7 parameters, no output schema), the description covers the essential: what the tool does, prerequisite steps, and that it creates a package. It could mention how to check transfer status (e.g., using 'get_package_transfers'), but the information provided is sufficient for most use cases.

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?

The schema covers 100% of parameters with descriptions, so the baseline is 3. The description adds value by explaining that file IDs come from 'list_files_on_integration', aiding parameter selection. No additional semantic detail beyond the schema is provided for other parameters, keeping the score at baseline.

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 ('Transfer files'), the source (cloud integration or Storage Gateway), and the destination (MASV). It also mentions creating a new package and initiating the transfer, which distinguishes it clearly from siblings like 'send_package_to_integration' (which does the reverse).

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

Usage Guidelines4/5

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

The description explicitly advises using 'list_files_on_integration' first to obtain file IDs, providing clear prerequisite guidance. It does not explicitly mention when not to use the tool or list alternatives, but the context of siblings (e.g., 'send_package_to_integration') implies the direction.

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/getmasv/masv-mcp-server'

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