Normalizes tool responses to comply with MCP specification.
Deprecated
Part of the deprecated ExMCP.Server.Tools API. Planned for removal in 2.0.0.
Prefer ExMCP.Server.DSL.Result normalization used by ExMCP.Server.DSL.
This module extracts the response normalization logic from the original Server.Tools module into a focused, testable unit.
Summary
Functions
Normalizes various response formats into MCP-compliant structure.
Normalizes error responses.
Functions
Normalizes various response formats into MCP-compliant structure.
Examples
# String response
normalize("Hello")
# => %{content: [%{type: "text", text: "Hello"}]}
# Map with text key
normalize(%{text: "Hello"})
# => %{content: [%{type: "text", text: "Hello"}]}
# Already normalized
normalize(%{content: [%{type: "text", text: "Hello"}]})
# => %{content: [%{type: "text", text: "Hello"}]}
Normalizes error responses.