Ragex. MCP. Formattable protocol
(Ragex v0.18.0)
View Source
Protocol for compacting MCP tool responses.
Types that implement this protocol define how to produce a compact representation (signatures, locations, counts only) versus a verbose one (full detail -- the current default behavior).
The formatter calls compact/2 when verbose: false (the new default)
and falls through to the raw value when verbose: true.
Implementing for a new struct
defimpl Ragex.MCP.Formattable, for: MyResult do
def compact(result, opts) do
%{summary: result.summary, count: result.count}
end
end
Summary
Functions
Produce a compact representation of the value.
Types
@type t() :: term()
All the types that implement this protocol.