client: Prefer structuredContent in toolJSON
CI / Test and build (pull_request) Successful in 12s

get_equity_historicals can return MCP StructuredContent with empty or
non-JSON TextContent. Prefer StructuredContent (marshal to RawMessage)
so paper tradey once/run can parse historicals.

#13
This commit is contained in:
ash
2026-09-05 04:40:48 +00:00
parent 3bffe88740
commit bc50f3fd6b
2 changed files with 94 additions and 0 deletions
+7
View File
@@ -101,6 +101,13 @@ func toolJSON(res *mcp.CallToolResult) (json.RawMessage, error) {
if err := res.GetError(); err != nil {
return nil, err
}
if res.StructuredContent != nil {
b, err := json.Marshal(res.StructuredContent)
if err != nil {
return nil, err
}
return json.RawMessage(b), nil
}
var b []byte
for _, c := range res.Content {
t, ok := c.(*mcp.TextContent)