Skip to main content
Glama

Record original JS behavior as replay cases

migrate_record
Idempotent

Record observed Node.js behavior for generated edge cases and semantic traps as JSONL cases, enabling replay against a Java port to verify migration parity.

Instructions

Run the original JS unit under Node on generated edge cases and the five semantic traps (undefined/null, UTF-16 code units, number formatting, sort/iteration order, date parsing), recording observed behavior as JSONL cases (cases/.jsonl) that migrate_replay replays against the Java port. Inspiration: rust-anything (MIT).

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "migrate_record"
  }
}

Input Schema

NameRequiredDescriptionDefault
nodeNoOptional path to the Node executable (default: JAVABYTES_NODE env or 'node')
pathNoPath to the original .js/.mjs/.cjs unit to record (inside an allowed root)
trapsNoOptional comma-separated subset of traps to include (default: all five): undefined_null, utf16_units, number_format, sort_order, date_parse
outputNoOptional .jsonl file path for the cases (default: <dir>/cases/<unit>.jsonl; must end with .jsonl)
functionsNoOptional comma-separated export names to record (default: all exports)
timeout_secondsNoNode run timeout in seconds (default 30)
cases_per_functionNoTrap tuples per function beyond the no-arg case (default 6)

Output Schema

NameRequiredDescriptionDefault
errorNo
messageNo
successYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv1.5.0

TDQS

A4.1/5.0
Behavior4/5

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

Annotations declare a non-read-only, non-destructive, idempotent, closed-world operation, and the description adds real substance beyond that: it spawns a Node subprocess against generated edge cases, targets five specific semantic traps, and persists results to a JSONL file. It does not disclose failure behavior (e.g., a crash or timeout on the Node side) or that output inside an allowed root is required, though the schema covers the latter.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

A single dense sentence with the action front-loaded and the trap enumeration inline. The trailing 'Inspiration: rust-anything (MIT)' attribution carries no operational value for an agent and could be dropped.

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?

An output schema exists, so return values need no explanation, and the description covers the mechanism, trap coverage, default artifact path, and downstream consumer. For a tool that shells out to Node, the main remaining gap is behavior on Node failure or trap-tuple generation limits, which is partially recoverable from schema defaults.

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 every parameter is already documented with defaults and constraints. The description adds only a human-readable naming of the five traps that map to the traps parameter values; it gives no additional syntax, interaction, or edge-case guidance beyond the schema.

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?

States a specific verb and resource: runs the original JS unit under Node on generated edge cases and records observed behavior as JSONL. It also names the downstream consumer (migrate_replay) and the artifact path convention (cases/<unit>.jsonl), which cleanly separates it from the sibling that replays the cases.

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?

The handoff to migrate_replay is explicit, making the position of this tool in the migration workflow clear: record first, then replay. There is no explicit guidance on when not to use it or what to do when Node is unavailable, so it falls short of full alternatives/exclusions coverage.

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