Skip to main content
Glama

Diff two Ruby hashes

ruby_hash_diff

Compare two Ruby hash literals to identify changed values, added or removed keys, and type changes. Accepts hash strings or raw test output for automated diff analysis.

Instructions

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.

Input Schema

TableJSON 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"}
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.

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

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