Canonical tool result helper.
Tool handlers can return plain Elixir values for the common case, but
FastestMCP.Tools.Result is the explicit shape when the tool needs:
- human-readable content that should not be derived automatically
- structured content for machine consumers
- result-level metadata
- an explicit
isErrorflag
When you provide structured_content without content, FastestMCP derives a
readable text block from the structured payload so MCP transports still emit a
complete tool result.
Examples
FastestMCP.Tools.Result.new("Release checklist generated",
structured_content: %{status: "ok"}
)
FastestMCP.Tools.Result.new(
[
%{type: "text", text: "Release checklist generated"},
%{type: "text", text: "Warnings: 0"}
],
structured_content: %{status: "ok", warnings: 0},
meta: %{source: "release-planner"}
)
Summary
Functions
Normalizes result-like values into %FastestMCP.Tools.Result{}.
Builds a normalized tool result.
Converts the helper struct into the normalized tool-result map used by the runtime.