Skip to main content
Glama

store

Compress data with auto-selected algorithm and save it under a key for later retrieval. Retrieve decompressed data using the key. Ideal for agents needing compressed key-value storage.

Instructions

Compress data and store it to disk with a key. Retrieve later with the key. Like a compressed key-value store for agents.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dataYesData to compress and store
nameNoKey name for retrieval. Auto-generated if not provided.
algorithmNoCompression algorithm

Implementation Reference

  • handleStore — The main handler for the 'store' tool. Compresses data using the specified algorithm (or auto), saves the compressed data to disk as a .bin file, writes metadata as a .json file, and returns the key and storage details.
    handleStore(args) {
      const { data, name, algorithm = 'auto' } = args;
      if (!data) return { error: 'Missing "data" parameter' };
    
      const key = name || createHash('sha256').update(data).digest('hex').slice(0, 16);
      const result = this.compressData(data, algorithm);
    
      const metadata = {
        key,
        algorithm: result.algorithm,
        originalSize: result.originalSize,
        compressedSize: result.compressedSize,
        ratio: result.ratio,
        storedAt: new Date().toISOString(),
        hash: createHash('sha256').update(data).digest('hex'),
      };
    
      const dataPath = join(STORE_DIR, `${key}.bin`);
      const metaPath = join(STORE_DIR, `${key}.json`);
      writeFileSync(dataPath, result.compressed);
      writeFileSync(metaPath, JSON.stringify(metadata, null, 2));
    
      this.stats.total_compressed++;
      this.stats.total_saved_bytes += result.originalSize - result.compressedSize;
      this.stats.operations++;
    
      return {
        key,
        stored_at: dataPath,
        original_size: result.originalSize,
        compressed_size: result.compressedSize,
        ratio: `${result.ratio.toFixed(1)}x`,
        saved: `${result.originalSize - result.compressedSize} bytes`
      };
    }
  • Tool definition and input schema for 'store' — defines the name, description, and JSON Schema input validation (data required, optional name and algorithm).
      name: 'store',
      description: 'Compress data and store it to disk with a key. Retrieve later with the key. Like a compressed key-value store for agents.',
      inputSchema: {
        type: 'object',
        properties: {
          data: { type: 'string', description: 'Data to compress and store' },
          name: { type: 'string', description: 'Key name for retrieval. Auto-generated if not provided.' },
          algorithm: { type: 'string', enum: ['auto', 'gzip', 'brotli', 'deflate'], description: 'Compression algorithm' }
        },
        required: ['data']
      }
    },
  • index.js:686-686 (registration)
    Tool dispatch — The 'store' case in the tools/call handler that routes to handleStore.
    case 'store': result = this.handleStore(args); break;
  • STORE_DIR constant — defines the storage directory (~/.mcp-compress) where compressed data and metadata files are written.
    const STORE_DIR = join(homedir(), '.mcp-compress');
Behavior3/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 describes the core behavior (compress, store, retrieve) but omits details like overwrite behavior, auth requirements, or what happens if the key already exists. The auto-generation of 'name' is not mentioned, though schema covers it.

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?

Two sentences with no wasted words. The description is front-loaded with the main action and uses a concise analogy.

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?

Lacks output schema information; no mention of what the tool returns (e.g., key, success status). Error conditions or size limits are not covered. Adequate for a simple store but incomplete for full understanding.

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 coverage is 100% with each parameter already described. The description adds minimal value beyond the schema, not explaining parameter constraints like algorithm choice impact or data format limits.

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 tool compresses data and stores it to disk with a key, and that it can be retrieved later. It uses a relatable analogy (compressed key-value store) and distinguishes itself from siblings like 'compress' and 'retrieve'.

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

Usage Guidelines3/5

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

The description implies usage for storing compressed data but does not explicitly state when to use this tool over alternatives like 'compress' or 'retrieve'. No exclusions or conditions are provided.

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/ShipItAndPray/mcp-compress'

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