Skip to content

fix(vtex): correct sales-performance metrics param description (all-5-or-none) - #547

Open
guitavano wants to merge 1 commit into
mainfrom
guitavano/fix-metrics-param-description
Open

fix(vtex): correct sales-performance metrics param description (all-5-or-none)#547
guitavano wants to merge 1 commit into
mainfrom
guitavano/fix-metrics-param-description

Conversation

@guitavano

@guitavano guitavano commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

What

Fixes the misleading metrics parameter description on the VTEX Sales Performance analytics tools.

The description claimed the endpoint "expects at least two" metrics. In reality the underlying analytics endpoint (sp-cards / sp-item-detail-table) only accepts the metrics param fully omitted (returns all 5 defaults) or all 5 supplied explicitly — any partial array of 1–4 items returns HTTP 422. The old wording led agents to send partial arrays and hit 422s.

Changes

  • Corrected salesMetricsListSchema.describe(...) (shared by VTEX_GET_SALES_PERFORMANCE_CARDS and VTEX_GET_SALES_PERFORMANCE_TABLE) to document the all-5-or-none constraint and the 422 behavior.
  • Added a table-specific variant salesTableMetricsListSchema that also tells the agent to omit metrics and use sortBy when ranking by a single metric — sortBy only exists on the table tool, so that guidance is scoped to it and kept off the cards tool.

Description-only change (plus the schema alias wiring); no runtime behavior change.

Notes / follow-ups

  • The 422 / all-5-or-none behavior comes from a live report, not endpoint verification here. If confirmed, a stronger follow-up would be to enforce it in the schema (reject partial arrays at validation) rather than only warn in the description.
  • Assumed sp-cards shares the same metric1..metricN constraint as the table (same param encoding + backend); if cards tolerates partial arrays, the shared warning can be narrowed.

🤖 Generated with Claude Code


Summary by cubic

Clarifies VTEX Sales Performance metrics parameter to reflect the endpoint’s all-5-or-none behavior and prevent 422 errors from partial arrays. Previously documented “at least two” is replaced with: omit metrics for defaults or provide all five; partial arrays return 422. Adds table-specific guidance to use sortBy for single-metric ranking. No runtime behavior change.

  • Updated salesMetricsListSchema.describe(...) used by VTEX_GET_SALES_PERFORMANCE_CARDS and VTEX_GET_SALES_PERFORMANCE_TABLE.
  • Added salesTableMetricsListSchema with sortBy guidance and wired it into the table tool; cards remain on the shared schema.
  • Validation logic is unchanged; this is a description-only update to reduce agent misconfiguration.

Written for commit ddb0184. Summary will update on new commits.

Review in cubic

The `metrics` param claimed the endpoint "expects at least two", but the
underlying analytics endpoint only accepts the param fully omitted (all 5
defaults) or all 5 metrics supplied explicitly — partial arrays (1-4 items)
return HTTP 422.

Split the shared metrics schema so the table tool additionally documents
using `sortBy` instead of a partial `metrics` array to rank by one metric;
the cards tool keeps the generic constraint.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant