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