Skip to main content
Glama

hashData

Generate cryptographic hashes for data using algorithms like SHA256 or MD5 to verify integrity or create digital fingerprints.

Instructions

Hash input data using Node.js crypto module

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
inputYesData to hash
algorithmNoHash algorithm to usesha256
encodingNoOutput encodinghex

Implementation Reference

  • The core handler function for the 'hashData' tool. It hashes the provided input string using the specified algorithm (default: sha256) and encoding (default: hex) via Node.js 'crypto.createHash', then returns a structured JSON response containing the inputs and computed hash.
    handler: async ({ 
      input, 
      algorithm = 'sha256', 
      encoding = 'hex' 
    }: { 
      input: string; 
      algorithm?: HashAlgorithm; 
      encoding?: 'hex' | 'base64' 
    }) => {
      try {
        const hash = createHash(algorithm)
          .update(input)
          .digest(encoding);
    
        return {
          content: [{
            type: 'text',
            text: JSON.stringify({
              input,
              algorithm,
              encoding,
              hash
            }, null, 2)
          }]
        };
      } catch (error) {
        throw new Error(`Hashing failed: ${error instanceof Error ? error.message : 'Unknown error'}`);
      }
    }
  • Input schema for the 'hashData' tool, defining required 'input' string, optional 'algorithm' enum (md5/sha1/sha256/sha512), and optional 'encoding' enum (hex/base64).
    inputSchema: {
      type: 'object',
      properties: {
        input: {
          type: 'string',
          description: 'Data to hash'
        },
        algorithm: {
          type: 'string',
          description: 'Hash algorithm to use',
          enum: ['md5', 'sha1', 'sha256', 'sha512'],
          default: 'sha256'
        },
        encoding: {
          type: 'string',
          description: 'Output encoding',
          enum: ['hex', 'base64'],
          default: 'hex'
        }
      },
      required: ['input']
    },
  • src/index.ts:10-10 (registration)
    Import statement that brings in the securityTools object, which defines and exports the 'hashData' tool.
    import { securityTools } from './tools/security.js';
  • src/index.ts:28-35 (registration)
    Merges 'securityTools' (containing 'hashData') into the central 'allTools' registry, making it available for MCP server tool listing and execution handlers.
    const allTools: ToolKit = {
      ...systemTools,
      ...networkTools,
      ...geoTools,
      ...generatorTools,
      ...dateTimeTools,
      ...securityTools
    };
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. While it mentions the Node.js crypto module implementation, it doesn't cover important behavioral aspects like whether this is a pure function (deterministic output), performance characteristics, memory usage, or error handling for invalid inputs/algorithms.

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 (7 words) and front-loaded with the core functionality. Every word earns its place - 'Hash' (action), 'input data' (resource), 'using Node.js crypto module' (implementation context). No wasted words or unnecessary elaboration.

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?

For a hashing tool with no annotations and no output schema, the description is insufficient. It doesn't explain what the tool returns (hash value format), doesn't mention common use cases for hashing, and provides no guidance on algorithm selection despite the algorithm parameter having multiple enum options with security implications.

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?

With 100% schema description coverage, the schema already fully documents all three parameters (input, algorithm, encoding) with descriptions, enums, and defaults. The description adds no additional parameter semantics beyond what's in the schema, meeting the baseline for high coverage.

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 action ('Hash') and resource ('input data'), and specifies the implementation method ('using Node.js crypto module'), which distinguishes it from generic hashing tools. However, it doesn't explicitly differentiate from sibling tools like 'compareHashes' that might also involve hashing operations.

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 sibling tools like 'compareHashes' for hash comparison scenarios or explain when hashing is appropriate versus other data processing methods available in the toolset.

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/cyanheads/toolkit-mcp-server'

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