fix: parse MCP result payloads and drop place idempotency_key

Typed result structs replace empty envelopes. Equity place sends
ref_id only so live additionalProperties:false schemas accept the call.
This commit is contained in:
2026-09-01 14:18:39 -05:00
parent f52a19181d
commit a6bf8632ce
22 changed files with 2225 additions and 74 deletions
+14
View File
@@ -208,3 +208,17 @@ func TestPortfolio_rhntest(t *testing.T) {
t.Fatalf("buying power %s", got.BuyingPower)
}
}
func TestSearch_parsesResults(t *testing.T) {
t.Parallel()
c := accounts.New(client.Func(func(ctx context.Context, name string, args map[string]any) (json.RawMessage, error) {
return json.RawMessage(`{"results":[{"symbol":"AAPL","name":"Apple","instrument_id":"i1"}]}`), nil
}))
got, err := c.Search(context.Background(), accounts.SearchRequest{Query: "apple"})
if err != nil {
t.Fatal(err)
}
if len(got.Results) != 1 || got.Results[0].Symbol != "AAPL" || got.Results[0].InstrumentID != "i1" {
t.Fatalf("%+v", got)
}
}