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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user