client: Honor IsError and extract JSON from tool text #15
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
CT113 still fails after #14 (
11feaad):make infoOK; papermake onceexit 2. StructuredContent prefer did not clear the live path → StructuredContent is likely nil and TextContent is non-JSON (or anisErrorsoft-fail).Deeper cause (verify)
go-sdk v1.7.0 documents:
CallToolResult.GetError()always returns nil on clients. CurrenttoolJSONonly callsGetError(), so it never seesIsError=truesoft failures. Those arrive as plain TextContent and surface asnon-json tool resultinstead of the real tool message.Also harden text JSON extraction: try each TextContent alone; if concatenated text is invalid, extract the first balanced
{…}/[…]JSON value.Goal
IsErroris set (use text content as message).isError, content types, structured nil/present, text prefix len + first ~80 runes (no secrets).Out of scope
Live/place, knobs/strategy, lab SSH.
Acceptance
IsError+text → error with that text (notnon-json); structured still preferred; text JSON; wrapped JSON in prose; non-JSON text alone stillnon-jsonwith shape hint.go test ./...green.develop; do not merge yourself.client: Honor IsError and extract JSON from tool textRe-prove (CT113 after merge/deploy)
Revert
git revert. No DB.Jerry may still send a sanitized dump; fold any new shape facts into the same PR if they arrive mid-flight.