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
+93 -9
View File
@@ -5,6 +5,7 @@ import (
"encoding/json"
"time"
decimal "github.com/alpacahq/alpacadecimal"
"s1d3sw1ped/robinhood-agentic-mcp/client"
"s1d3sw1ped/robinhood-agentic-mcp/internal/wire"
)
@@ -27,16 +28,34 @@ type IndexesRequest struct {
Symbols string // comma-separated; live schema is a string, not an array
}
// Index is one market index from get_indexes.
type Index struct {
ID string
Symbol string
Name string
}
// IndexesResult is the parsed get_indexes payload.
type IndexesResult struct{}
type IndexesResult struct {
Indexes []Index
}
// IndexQuotesRequest is the argument set for get_index_quotes.
type IndexQuotesRequest struct {
InstrumentIDs []string
}
// IndexQuote is a live index level from get_index_quotes.
type IndexQuote struct {
InstrumentID string
Value decimal.Decimal
State string
}
// IndexQuotesResult is the parsed get_index_quotes payload.
type IndexQuotesResult struct{}
type IndexQuotesResult struct {
Quotes []IndexQuote
}
// IndexHistoricalsRequest is the argument set for get_index_historicals.
type IndexHistoricalsRequest struct {
@@ -46,8 +65,18 @@ type IndexHistoricalsRequest struct {
Interval string // required — no hidden default
}
// IndexBar is one OHLC bar from get_index_historicals.
type IndexBar struct {
InstrumentID string
Time time.Time
Open, High, Low, Close decimal.Decimal
Interpolated bool
}
// IndexHistoricalsResult is the parsed get_index_historicals payload.
type IndexHistoricalsResult struct{}
type IndexHistoricalsResult struct {
Bars []IndexBar
}
// FinancialsRequest is the argument set for get_financials.
type FinancialsRequest struct {
@@ -56,8 +85,20 @@ type FinancialsRequest struct {
Limit int
}
// FinancialPeriod is one fiscal period from get_financials.
type FinancialPeriod struct {
Symbol string
Period string
Revenue decimal.Decimal
GrossProfit decimal.Decimal
NetIncome decimal.Decimal
NetMargin decimal.Decimal
}
// FinancialsResult is the parsed get_financials payload.
type FinancialsResult struct{}
type FinancialsResult struct {
Periods []FinancialPeriod
}
// EarningsResultsRequest is the argument set for get_earnings_results.
type EarningsResultsRequest struct {
@@ -77,8 +118,16 @@ type EarningsCalendarRequest struct {
Filter string
}
// EarningsEvent is one calendar row from get_earnings_calendar.
type EarningsEvent struct {
Symbol string
ReportDate string
}
// EarningsCalendarResult is the parsed get_earnings_calendar payload.
type EarningsCalendarResult struct{}
type EarningsCalendarResult struct {
Events []EarningsEvent
}
// SECFilingIndexRequest is the argument set for get_sec_filing_index.
type SECFilingIndexRequest struct {
@@ -89,8 +138,18 @@ type SECFilingIndexRequest struct {
Cursor string
}
// SECFilingRef is one filing from get_sec_filing_index.
type SECFilingRef struct {
FilingID string
FormType string
FiledAt string
}
// SECFilingIndexResult is the parsed get_sec_filing_index payload.
type SECFilingIndexResult struct{}
type SECFilingIndexResult struct {
Filings []SECFilingRef
NextCursor string
}
// SECFilingRequest is the argument set for get_sec_filing.
type SECFilingRequest struct {
@@ -98,8 +157,19 @@ type SECFilingRequest struct {
Section string
}
// SECSection is one table-of-contents row or section body.
type SECSection struct {
ID string
Title string
Text string
}
// SECFilingResult is the parsed get_sec_filing payload.
type SECFilingResult struct{}
type SECFilingResult struct {
FilingID string
Sections []SECSection
Text string
}
// SECFilingFactsRequest is the argument set for get_sec_filing_facts.
type SECFilingFactsRequest struct {
@@ -108,7 +178,15 @@ type SECFilingFactsRequest struct {
}
// SECFilingFactsResult is the parsed get_sec_filing_facts payload.
type SECFilingFactsResult struct{}
type SECFact struct {
Concept string
Value string
Unit string
}
type SECFilingFactsResult struct {
Facts []SECFact
}
// SECFilingFactsCatalogRequest is the argument set for get_sec_filing_facts_catalog.
type SECFilingFactsCatalogRequest struct {
@@ -119,7 +197,13 @@ type SECFilingFactsCatalogRequest struct {
}
// SECFilingFactsCatalogResult is the parsed get_sec_filing_facts_catalog payload.
type SECFilingFactsCatalogResult struct{}
type SECConcept struct {
Name string
}
type SECFilingFactsCatalogResult struct {
Concepts []SECConcept
}
// Indexes calls get_indexes.
func (c *Client) Indexes(ctx context.Context, req IndexesRequest) (IndexesResult, error) {