Skip to main content
Glama

hashData

Generate secure hashes from input data using specified algorithms like MD5, SHA1, SHA256, or SHA512, with output in hex or base64 encoding. Ideal for data integrity and security applications.

Instructions

Hash input data using Node.js crypto module

Input Schema

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

Implementation Reference

  • The asynchronous handler function that executes the hashing logic using Node.js crypto.createHash, taking input data, algorithm, and encoding parameters.
    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'}`);
      }
    }
  • The inputSchema defining the parameters for the hashData tool: input (required string), algorithm (enum with default sha256), encoding (enum with default hex).
    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:27-33 (registration)
    Registration of securityTools (including hashData) by spreading into the allTools object used by MCP server handlers for tool listing and execution.
    const allTools: ToolKit = {
      ...encodingTools,
      ...geoTools,
      ...generatorTools,
      ...dateTimeTools,
      ...securityTools
    };
  • Type definition for HashAlgorithm used in the hashData input schema and handler.
    export type HashAlgorithm = 'md5' | 'sha1' | 'sha256' | 'sha512';
Behavior2/5

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

No annotations are provided, so the description carries the full burden. It mentions the Node.js crypto module but doesn't disclose behavioral traits such as performance characteristics, error handling, or security implications (e.g., using weaker algorithms like md5). This leaves gaps in understanding the tool's operation beyond basic functionality.

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 a single, efficient sentence that directly states the tool's purpose without unnecessary words. It is appropriately sized and front-loaded, making it easy for an agent to parse quickly.

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?

Given the lack of annotations and output schema, the description is incomplete. It doesn't explain return values, error conditions, or practical usage scenarios. For a tool with 3 parameters and no structured behavioral hints, more context is needed to ensure proper agent invocation.

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 description coverage is 100%, so the schema already documents all parameters (algorithm, encoding, input) with enums and defaults. The description adds no additional meaning beyond what the schema provides, such as examples or edge cases, resulting in a baseline score of 3.

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'), specifying the implementation method ('using Node.js crypto module'). It distinguishes from siblings like encodeBase64 or generateUUID by focusing on hashing. However, it doesn't explicitly differentiate from compareHashes, which might be a related sibling.

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?

No guidance is provided on when to use this tool versus alternatives like compareHashes or encodeBase64. The description lacks context about use cases, prerequisites, or exclusions, leaving the agent without direction on appropriate application.

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

Related 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/MissionSquad/mcp-helper-tools'

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