Skip to main content
Glama

decompress

Extract ZIP file contents to a specified directory with options for password-protected archives, overwriting files, and creating output directories.

Instructions

Decompress local ZIP file to specified directory

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
inputYesZIP file path to decompress
outputYesOutput directory path
optionsNo

Implementation Reference

  • Handler logic for the "decompress" tool using AdmZip to extract ZIP files.
    case "decompress": {
      const input = args.input as string;
      const output = args.output as string;
      const options = (args.options as any) || {};
    
      if (!fs.existsSync(input)) {
        throw new Error(`ZIP file does not exist: ${input}`);
      }
    
      if (options.createDirectories && !fs.existsSync(output)) {
        fs.mkdirSync(output, { recursive: true });
      }
    
      if (!fs.existsSync(output)) {
        throw new Error(`Output directory does not exist: ${output}`);
      }
    
      const zip = new AdmZip(input);
    
      zip.extractAllTo(output, options.overwrite || false);
    
      const entries = zip.getEntries();
    
      return {
        content: [
          {
            type: "text",
            text: JSON.stringify(
              {
                success: true,
                output: output,
                filesExtracted: entries.length,
                files: entries.map((e) => e.entryName),
              },
              null,
              2,
            ),
          },
        ],
      };
    }
  • Schema definition for the "decompress" tool in the listTools request handler.
      name: "decompress",
      description: "Decompress local ZIP file to specified directory",
      inputSchema: {
        type: "object",
        properties: {
          input: {
            type: "string",
            description: "ZIP file path to decompress",
          },
          output: {
            type: "string",
            description: "Output directory path",
          },
          options: {
            type: "object",
            properties: {
              overwrite: {
                type: "boolean",
                description: "Overwrite existing files",
              },
              password: {
                type: "string",
                description: "Password for encrypted ZIP",
              },
              createDirectories: {
                type: "boolean",
                description: "Create output directory if it doesn't exist",
              },
            },
          },
        },
        required: ["input", "output"],
      },
    },
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/loscolmebrothers/zip-mcp'

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