Skip to main content
Glama

analyze

Analyzes data compressibility to determine optimal algorithm, compression ratio, and provide compression recommendations before processing.

Instructions

Analyze how compressible data is. Shows best algorithm, compression ratio, entropy, and recommendation. Use this before deciding whether to compress.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dataYesThe data to analyze

Implementation Reference

  • The handler function that implements the "analyze" tool logic.
    handleAnalyze(args) {
      const { data } = args;
      if (!data) return { error: 'Missing "data" parameter' };
    
      const result = this.compressData(data, 'auto');
      const buf = Buffer.from(data, 'utf-8');
    
      // Estimate compressibility characteristics
      const uniqueChars = new Set(data).size;
      const entropy = this.shannonEntropy(data);
    
      return {
        original_size: buf.length,
        best_algorithm: result.algorithm,
        best_compressed_size: result.compressedSize,
        best_ratio: `${result.ratio.toFixed(1)}x`,
        all_algorithms: result.allResults,
        entropy_bits_per_char: entropy.toFixed(3),
        unique_characters: uniqueChars,
        total_characters: data.length,
        compressibility: entropy < 3 ? 'HIGH' : entropy < 5 ? 'MEDIUM' : 'LOW',
        recommendation: result.ratio > 5 ? 'Highly compressible — compress everything'
          : result.ratio > 2 ? 'Moderately compressible — compress for storage/transit'
          : 'Low compressibility — data is already dense/random'
      };
    }
  • index.js:333-343 (registration)
    Registration of the "analyze" tool with its schema definition.
    {
      name: 'analyze',
      description: 'Analyze how compressible data is. Shows best algorithm, compression ratio, entropy, and recommendation. Use this before deciding whether to compress.',
      inputSchema: {
        type: 'object',
        properties: {
          data: { type: 'string', description: 'The data to analyze' }
        },
        required: ['data']
      }
    },
Behavior4/5

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

No annotations provided, so description carries full burden. Discloses specific analysis outputs (best algorithm, compression ratio, entropy, recommendation) which compensates for missing output schema. Could explicitly state read-only nature, but implied by 'Shows'.

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?

Three sentences with zero waste: purpose front-loaded, outputs detailed, usage guideline positioned last. Each sentence earns its place with no redundancy.

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?

Appropriately complete for low complexity (1 simple param). Without output schema, description successfully enumerates return values (algorithm, ratio, entropy, recommendation). Missing only explicit safety declaration.

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 'data' parameter well-described in schema. Description references 'data' implicitly but adds no specific format constraints or examples beyond schema 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?

Specific verb 'Analyze' + resource 'compressible data' with clear scope. Effectively distinguishes from sibling 'compress' by focusing on measurement rather than transformation.

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?

Explicit sequential guidance 'Use this before deciding whether to compress' establishes clear workflow position. Implies relationship to 'compress' sibling without explicitly naming it.

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