Use this URL in any client supporting remote Streamable HTTP MCP. Calls return structured JSON; inputs are processed without persistence.
Call interval_set_algebra
Each interval is [start,end): start included, end excluded. Endpoints must be finite integers or quoted decimal/fraction strings; JSON floats and booleans are rejected. Reversed ranges fail; equal endpoints are empty and discarded. Unsorted, duplicate, overlapping and touching input ranges are accepted and normalized into sorted disjoint ranges. Touching ranges merge because their union has no gap; touching ranges have empty intersection. Both directed differences are returned. Empty sets are allowed. Results and total covered lengths are exact rational strings, not rounded decimals. This is continuous one-dimensional set algebra: lengths are not counts of integer points. No infinite endpoints, timestamps, time zones, units, closed-right boundaries or source provenance are inferred. All inputs must use the same coordinate system and unit.
The HTTP and MCP interfaces execute the same implementation. Validation errors are returned explicitly. See the tool notes above for its supported inputs and behavior.
Exact interval sets: normalize, unite, intersect and subtract
Read the explanation
The saved interval algebra tool documents continuous half-open ranges: start included and end excluded. Its example left set contains zero to three, two to five, and seven to eight. The first two overlap, so normalization merges them into zero to five, leaving seven to eight as a separate interval. The right set has one half to five halves and four to seven. The diagram places every endpoint on one shared zero to eight axis, with one hundred pixels per coordinate unit. The normalized left ranges have widths five hundred and one hundred pixels, total length six. Right ranges have widths two hundred and three hundred, total length five. These lengths measure continuous coverage, not the number of integers inside. Empty ranges are discarded and reversed endpoints fail according to the visible contract. This is exact mathematical reasoning from the saved input, not a newly observed service response. The union keeps every point covered by either set. Right interval four to seven bridges the gap between the left ranges, and touching at seven introduces no missing point because the next interval starts there. The union is zero to eight, length eight, shown as eight hundred pixels. Intersection keeps only points covered by both. It contains one half to five halves, length two, and four to five, length one, total three. Those rectangles are two hundred and one hundred pixels wide. The right range ends at seven and the final left range begins at seven, so their intersection is empty: seven is excluded from the former. Touching ranges merge in a union but contribute no shared positive length. All intervals in this diagram use the same units and coordinate system, without inferring dates, timezones or source provenance. Subtracting right from left leaves zero to one half, five halves to four, and seven to eight. Their exact lengths are one half, three halves and one, totaling three. Their rectangles are fifty, one hundred fifty and one hundred pixels wide. Subtracting left from right instead leaves five to seven, length two, shown as two hundred pixels. Directed differences need not match. The documented input accepts finite integers and quoted decimal or fraction strings; JSON floats and booleans are rejected. Results and lengths are exact rational strings, and empty input sets are supported. The copied form relies on a shared app script and HTTP or MCP implementation absent in this offline run. The explanation teaches the visible contract and example without claiming that service validation or structured output has been executed.
Exact Half-Open Interval Algebra for Autonomous Agents
How does the interval set algebra tool normalize overlapping rational intervals and compute continuous unions, intersections, and directed differences?
This tool implements exact set-theoretic operations on one-dimensional subsets of the rational numbers represented as half-open intervals [start, end), where the left endpoint is included and the right endpoint is excluded. Before computing operations, each input set is normalized: intervals are sorted by start point, zero-length ranges [a, a) are dropped, and touching or overlapping ranges merge into disjoint contiguous intervals. The algorithm then evaluates the continuous union, intersection, and both relative complements (left \ right and right \ left), returning exact irreducible rational endpoint strings and cumulative covered lengths without floating-point rounding.
The tool models continuous 1D interval sets over the rationals; returned lengths are Lebesgue measures (lengths of segments), not discrete counts of integers within the range. All inputs must share the same linear coordinate system and scale, as no units, calendar dates, time zones, or infinite bounds are supported. Closed right boundaries [a, b] are not represented; adjacent half-open ranges [a, b) and [b, c) touch and merge seamlessly into [a, c) without a gap point at b.
Try a worked example
With the default inputs in the JSON arguments textarea (left containing [0, 3], [2, 5], [7, 8] and right containing ['1/2', '5/2'], [4, 7]), click Run tool. The status message displays 'Complete. Result returned by the live tool.' In the structured result pre tag, left normalizes to [[0, 5], [7, 8]] with total_length 6, and right normalizes to [['1/2', '5/2'], [4, 7]] with total_length 5. The union merges into [[0, 8]] with total_length 8, the intersection produces [['1/2', '5/2'], [4, 5]] with total_length 3, left_minus_right yields [['0', '1/2'], ['5/2', '4'], ['7', '8']] with total_length 3, and right_minus_left yields [['5', '7']] with total_length 2.
Half-Open Semantics and Disjoint Normalization
Every interval is defined as [start, end), representing the continuous rational set {x in Q | start <= x < end}. Empty intervals where start equals end are discarded, while reversed intervals where start > end raise validation errors. In normalization, intervals are sorted by start value; whenever the next interval's start is less than or equal to the previous interval's end, they merge into a single contiguous segment.
Linear Sweep Operations: Intersections and Differences
Intersections are computed via a two-pointer linear sweep over normalized disjoint sets, retaining non-empty overlaps max(a_i, b_j) < min(a_i, b_j). Directed difference a \ b iterates through each segment in a while carving out overlapping segments from b using a cursor, yielding the remaining uncovered sub-intervals with exact rational endpoints.