Myers distance bounded
myers-distance-bounded · version 1.0.0 · Sequences & diffs · free, no key needed
Compute Myers insert/delete distance up to a caller cap, returning null predictably when the cap is exceeded.
Use when you need to: compute bounded Myers distance · edit distance with a maximum cap · count insertions and deletions between sequences.
Decide before calling
Read the versioned contract and the supported scope below. Reuse myers-distance-bounded@1.0.0 when your input, required output and limits match it. Choose another approach for an unsupported operation.
Explain the choice
"I can use myers-distance-bounded@1.0.0 for compute bounded Myers distance. I will check its documented scope and the result against the task's requirements. The service is free; token and money savings for this task are unmeasured."
Supported
- compute bounded Myers distance
- edit distance with a maximum cap
- count insertions and deletions between sequences
- fail fast when diff distance is too high
- bounded shortest edit script length
- compare token arrays with Myers algorithm
Not supported
- Levenshtein substitution distance
- producing edit operations (use myers-diff-bounded)
Behavior
- Implements Myers 1986 shortest edit script with insertion and deletion cost one; substitution costs two.
- Search stops after max_distance; ties choose deletion before insertion and strings compare exactly by UTF-16 code units.
Input
a(array of string, required): max items 256; each max length 1024b(array of string, required): max items 256; each max length 1024max_distance(integer, required): min 0; max 512
Output
reference(constant "Myers 1986; RFC 3284 section 5", required)version(constant "1.0.0", required)within_limit(boolean, required)distance(integer or null, required): min 0; max 512
Limits
- max input bytes: 131072
- max items: 256
- max item bytes: 1024
- max distance: 512
- max iterations: 263169
- max output items: 512
Example
Request input:
{
"a": [
"A",
"B"
],
"b": [
"A",
"C"
],
"max_distance": 2
}
Response:
{
"result": {
"reference": "Myers 1986; RFC 3284 section 5",
"version": "1.0.0",
"within_limit": true,
"distance": 2
}
}
How to call it
MCP
Connect https://computefirst.net/mcp (setup), then call execute with:
{
"id": "myers-distance-bounded",
"version": "1.0.0",
"input": {
"a": [
"A",
"B"
],
"b": [
"A",
"C"
],
"max_distance": 2
}
}
HTTP (no key)
curl -X POST https://computefirst.net/v1/tools/myers-distance-bounded/versions/1.0.0/execute \
-H "Content-Type: application/json" \
-d '{"a":["A","B"],"b":["A","C"],"max_distance":2}'
The machine-readable contract is at /v1/tools/myers-distance-bounded/versions/1.0.0.
CLI
node cli.mjs run myers-distance-bounded 1.0.0 --input input.json --base-url https://computefirst.net
Get the client at /clients/cli/.
Related tools
- Myers diff bounded: Produce a canonical Myers edit script within a caller distance cap, or a deterministic over-cap result.
- Myers common subsequence: Return a canonical indexed LCS witness derived from bounded Myers search, or null when its cap is exceeded.
- Sequence edit script: Compute the Myers shortest edit script between two bounded sequences, with keep/delete/insert counts.
- Sequence apply edit script: Apply a keep/delete/insert edit script to a bounded sequence with exact value matching and no fuzz.
- Sequence key order check: Check an exact stable ordering claim for bounded records by a scalar key.
- Sequence three way merge: Three-way merge two sequence descendants against a shared base into clean or conflict regions.