Raxol.MCP.Diff (Raxol MCP v2.6.0)

Copy Markdown View Source

Simple map diff utility for detecting resource/model changes.

Compares two maps and returns which keys were added, removed, or changed. Used by the ToolSynchronizer to compute model projection diffs for streaming notifications.

Summary

Functions

Returns true if the diff contains any changes.

Compute the diff between two maps.

Types

diff_result()

@type diff_result() :: %{
  added: %{required(term()) => term()},
  removed: [term()],
  changed: %{required(term()) => {old :: term(), new :: term()}}
}

Functions

changed?(map)

@spec changed?(diff_result()) :: boolean()

Returns true if the diff contains any changes.

diff(old, new)

@spec diff(map(), map()) :: diff_result()

Compute the diff between two maps.

Returns a map with :added, :removed, and :changed keys.