pub async fn call_tool_wrapped(
socket: &Path,
tool: &str,
arguments: Value,
) -> Result<Value>Expand description
Call one trusty-memory tool through the tools/call envelope and return
its parsed inner result.
Why: the one-shot composition the turn recorder’s dual-write needs —
after #2424 every memory_sink write goes through this so the parsed
result it inspects (e.g. memory_remember’s "status":"skipped"
detection, #2363) has the SAME shape it had under the old direct
dispatch, keeping the caller’s success/skipped logic unchanged.
What: builds the params via tools_call_params, POSTs via
call_memory_tool_at(socket, "tools/call", ..), and unwraps the
response via parse_tools_call_envelope. A JSON-RPC error (the shape
trusty-memory returns when the inner tool itself fails — its dispatcher
converts tool errors via JsonRpcResponse::from_anyhow) surfaces as
Err from call_memory_tool_at; an unparseable envelope surfaces as
its own Err so fail-open callers can warn on it distinctly.
Test: tests::call_tool_wrapped_round_trips_against_mock,
tests::call_tool_wrapped_errs_on_malformed_envelope; exercised
end-to-end by session::memory_sink::tests::* and
tools::recall_session::tests::*.