Skip to main content
Glama

rubyhash-mcp

MCP server for RubyHash. Gives any MCP-capable agent (Claude Code, Claude Desktop, Cursor, and others) two deterministic Ruby tools:

  • ruby_hash_diff: compare two Ruby hash literals, or paste raw failing Minitest/RSpec output, and get a structured report of exactly what changed: changed values with before and after, added and removed keys, and explicit type changes (nil to String, Integer to Float, symbol keys vs string keys).

  • ruby_to_json: convert a Ruby hash or array literal (hashrockets, symbol keys, shorthand syntax, nesting, nil/true/false) to clean JSON with sorted keys.

Everything runs locally in the server process. Nothing is uploaded, logged, or stored, the same privacy promise as rubyhash.dev.

Tools

  • ruby_hash_diff: Compare two Ruby hash literals, or paste raw failing Minitest/RSpec output, and get a structured report: changed values with before and after, added and removed keys, and explicit type changes (nil to String, Integer to Float, symbol keys vs string keys).

  • ruby_to_json: Convert a Ruby hash or array literal (hashrockets, symbol keys, shorthand syntax, nesting, nil/true/false) to clean JSON with alphabetically sorted keys.

Related MCP server: JSON Compare MCP Server

Why an agent would want this

When a Ruby test fails on two large nearly identical hashes, comparing them by reading is slow and error prone, for humans and for language models. A 40-key nested hash diff burns context and invites mistakes. This server does the comparison with a real recursive descent parser and hands back only the differences, deterministically.

Install

{
  "mcpServers": {
    "rubyhash": {
      "command": "npx",
      "args": ["-y", "rubyhash-mcp"]
    }
  }
}

Or for Claude Code:

claude mcp add rubyhash -- npx -y rubyhash-mcp

Example

Input (raw test output):

-{"uid"=>"u@example.test", "role"=>"admin", "seats"=>3}
+{"uid"=>"u@example.test", "role"=>"editor", "seats"=>3.0}

Output:

{
  "equal": false,
  "summary": "2 changed, 0 added, 0 removed, 1 type change",
  "changed": [
    { "path": "role", "before": "admin", "after": "editor", "typeChanged": false },
    { "path": "seats", "before": 3, "after": 3, "beforeType": "Integer", "afterType": "Float", "typeChanged": true }
  ]
}

Also available as an HTTP API

If you cannot run a local MCP server, the same tools are exposed at the RubyHash Agent API, with an OpenAPI description and an x402 machine-payable catalog.

Development

npm install
npm test   # 36 unit tests

License

MIT for this package. The rubyhash.dev site and its browser tool are separate, private, and all rights reserved.

Available Tools

2 tools
ruby_hash_diffDiff two Ruby hashesA

Compare two Ruby hash literals and return exactly what changed: changed values with before/after, added and removed keys, and explicit type changes (nil to String, Integer to Float, symbol vs string keys). Pass either expected and actual as Ruby hash strings, or pass raw failing Minitest/RSpec output in raw and the first two hash literals found will be compared. Much cheaper and more reliable than eyeballing large nested hashes in test output.

ParametersJSON Schema
NameRequiredDescriptionDefault
rawNoRaw failing test output containing two hash literals (lines may be prefixed with - and +)
actualNoActual Ruby hash literal, e.g. {"role"=>"editor"}
expectedNoExpected Ruby hash literal, e.g. {"role"=>"admin"}

TDQS

A4.4/5.0
Behavior4/5

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

No annotations provided, so description carries full burden. It discloses that the tool compares hashes and returns specific diff details, including type changes. Does not mention side effects, but tool is inherently read-only and non-destructive.

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, front-loaded with purpose, no redundant information. Every part contributes to understanding the tool's function and usage.

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?

No output schema, but description lists return details (changed values, added/removed keys, type changes). Adequate for a 3-param tool with well-described behavior, though additional output format info could help.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, but description adds value by explaining how the 'raw' parameter extracts hash literals from test output, and that actual/expected are Ruby hash strings. This goes beyond schema descriptions.

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 compares two Ruby hash literals and returns changed values, added/removed keys, and type changes. Differentiates from sibling ruby_to_json by focusing on diffing rather than conversion.

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?

Provides guidance on using either raw test output or direct expected/actual hashes. Does not explicitly state when not to use or mention alternatives beyond the sibling tool name, but gives clear context for use cases.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

ruby_to_jsonConvert a Ruby hash to JSONA

Parse a Ruby hash or array literal (hashrockets, symbol keys, shorthand syntax, nesting, nil/true/false) and return clean JSON with alphabetically sorted keys. Symbols are rendered as ":name" strings.

ParametersJSON Schema
NameRequiredDescriptionDefault
hashYesRuby hash or array literal, e.g. {name: "x", "role" => :admin}
sort_keysNoSort hash keys alphabetically (default true)

TDQS

A3.7/5.0
Behavior3/5

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

With no annotations provided, the description carries the full burden. It discloses key behaviors: sorting keys and rendering symbols as ':name' strings. However, it does not address error handling for invalid Ruby input or whether the output is a JSON string (vs. object), leaving gaps.

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 concise sentences with no fluff. The description is front-loaded with the core action and includes relevant details about syntax and output formatting.

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?

For a tool with two well-documented parameters and no output schema, the description provides adequate context for basic usage. However, it lacks information about error behavior and output format specifics, which would be needed for complete 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%, so the description's value beyond the schema is limited. It adds a detail about symbol rendering but does not explain the effect of sort_keys beyond what the schema states. Baseline 3 is appropriate.

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's purpose: parsing a Ruby hash/array literal and returning clean JSON with sorted keys. It specifies supported syntax (hashrockets, symbol keys, shorthand, nesting, nil/true/false), making it distinct from the sibling tool ruby_hash_diff.

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 (when you need Ruby-to-JSON conversion) but does not explicitly state when to use this tool versus alternatives like ruby_hash_diff. No exclusions or prerequisites are mentioned.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. 2 tool updatesv0.1.0
    • First observedruby_hash_diff
    • First observedruby_to_json

TDQS

A3.9/5.0
Disambiguation5/5

The two tools have clearly distinct purposes: one compares two Ruby hashes and returns a diff, the other converts a Ruby hash/array literal to JSON. There is no overlap or ambiguity.

Naming Consistency5/5

Both tool names follow a consistent verb_noun snake_case pattern: ruby_hash_diff and ruby_to_json. The prefix 'ruby_' is shared, and the second part describes the action ('hash_diff' vs 'to_json').

Tool Count3/5

With only 2 tools, the server is minimal but still focused. It feels slightly thin for a general utility server, but for a niche Ruby hash utility it is acceptable and not excessive.

Completeness3/5

The tools cover diffing and conversion, which are useful but there are obvious gaps such as merging, validation, or formatting. The surface is not severely incomplete but lacks typical CRUD lifecycle coverage.

Maintenance

ActivitySlowing
ResponsivenessSyncing

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

  • F
    license
    Not graded
    quality
    Not graded
    maintenance
    Enables intelligent file and folder comparison with advanced text normalization, duplicate detection, and line-level diff analysis. Provides secure workspace-constrained file operations with CRC32-based exact matching and smart text comparison capabilities.
    -
  • A
    license
    Not graded
    quality
    D
    maintenance
    Enables deep, order-independent comparison of JSON files to detect differences including missing keys, value mismatches, and type differences. Provides detailed reports with path tracking for precise identification of variations between JSON structures.
    MIT
  • A
    license
    Not graded
    quality
    D
    maintenance
    Deterministic JSON validation and repair for AI agents. Validates, repairs, schema-checks, and diffs JSON so long-running agents don't corrupt their session state with malformed writes.
    MIT

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/builtbyproxy/rubyhash-mcp'

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