Skip to content

feat(billing-cost-management-mcp-server): add dimension_key and document ProductAttributes filters in cost-explorer - #4990

Merged
finklen-amazon merged 3 commits into
awslabs:mainfrom
finklen-amazon:bcm-ce-product-attributes
Nov 3, 2026
Merged

finklen-amazon merged 3 commits into
awslabs:mainfrom
finklen-amazon:bcm-ce-product-attributes

Conversation

@finklen-amazon

Copy link
Copy Markdown
Contributor

Summary

Changes

cost-explorer had no way to send DimensionKey to GetDimensionValues, so the values of a PRODUCT_ATTRIBUTE key could not be listed. Its description also did not name the ProductAttributes filter leaf.

  • cost-explorer takes dimension_key and sends it as DimensionKey (getDimensionValues, dimension=PRODUCT_ATTRIBUTE). If it is omitted or empty, the response lists the keys.
  • The description documents:
    • the ProductAttributes leaf and its MatchOptions (EQUALS, ABSENT, CASE_SENSITIVE)
    • that Amazon Bedrock is the only supported service, with keys provider, model, inferenceType, feature
    • that keys and values are case-sensitive, while search_string matches partially and case-insensitively
    • that data starts 2026-09-01: a period that starts earlier fails, even if most of it is later
    • the PRODUCT_ATTRIBUTE dimension-reference entry
  • It also documents the results that come back silently, with no error:
    • A wrong key or value returns $0.
    • ABSENT or [""] with a wrong key matches every Bedrock cost.
    • Not and a PRODUCT_ATTRIBUTE group_by cover only Bedrock costs, so their totals do not reach the account total.
    • Group labels have the form key$value.
    • A wrong dimension_key returns only "".
  • It documents the SERVICE-scope rule:
    • A SERVICE leaf anywhere must keep the result to Bedrock services.
    • Under And, one such leaf is enough; under Or, every branch needs one; a leaf under Not never counts.
    • getDimensionValues requires such a leaf, paired in an And.
    • Bedrock costs appear under several SERVICE names.
  • It documents that the forecasts reject the leaf.

User experience

Before: an agent could not list product attribute values. It had nothing telling it that a ProductAttributes filter exists, and nothing to warn it that a wrong key returns $0, or that Not and ABSENT cover only Bedrock costs.

After: {"operation": "getDimensionValues", "dimension": "PRODUCT_ATTRIBUTE", "dimension_key": "model"} lists the model names, which can then be used in a ProductAttributes filter. The description tells the agent about each of the results above.

Testing

  • Unit tests: 4379 passed. New tests cover dimension_key forwarding, and that DimensionKey is omitted when the key is empty, in both the tool and the operation, plus a description contract test for the new text. The existing contract tests now treat PRODUCT_ATTRIBUTE as a key accepted in fewer places.
  • Live checks against Cost Explorer: read-only, through the served tool over stdio. Every claim in the new text was checked against the public API reference (GetDimensionValues, Expression, ProductAttributeValues) and with live calls:
    • On this branch: 18/18 claims pass.
    • On main: 13/18. The 5 that fail are the dimension_key claims and the description text. The 13 that pass are regression guards for existing API behavior, such as ProductAttributes filters already passing through the filter argument.

Checklist

  • I have reviewed the contributing guidelines
  • I have performed a self-review of this change
  • Changes have been tested
  • Changes are documented

Is this a breaking change? (Y/N) N

RFC issue number:

Checklist:

  • Migration process documented
  • Implement warnings (if it can live side by side)

Acknowledgment

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of the project license.

…ent ProductAttributes filters in cost-explorer

getDimensionValues had no way to send DimensionKey, so the values of a
PRODUCT_ATTRIBUTE key could not be listed, and the description did not
name the ProductAttributes filter leaf at all.

- cost-explorer takes dimension_key and sends it as DimensionKey.
- The description documents the ProductAttributes leaf (Amazon Bedrock
  keys, case-sensitive, data from 2026-09-01, MatchOptions), its silent
  results (a wrong key or value returns $0; ABSENT or [""] matches all
  Bedrock costs for a wrong key; Not and a PRODUCT_ATTRIBUTE group_by
  cover only supported services), the SERVICE filter getDimensionValues
  requires with it, and that the forecasts reject it.
@codecov

codecov Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.79%. Comparing base (69e2666) to head (1d99fe7).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4990      +/-   ##
==========================================
- Coverage   93.79%   93.79%   -0.01%     
==========================================
  Files        1080     1080              
  Lines       94712    94714       +2     
  Branches    15442    15443       +1     
==========================================
+ Hits        88833    88834       +1     
  Misses       3505     3505              
- Partials     2374     2375       +1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@finklen-amazon
finklen-amazon added this pull request to the merge queue Nov 3, 2026
Merged via the queue into awslabs:main with commit 7b79ba9 Nov 3, 2026
138 checks passed
@finklen-amazon
finklen-amazon deleted the bcm-ce-product-attributes branch November 3, 2026 15:12
@github-project-automation github-project-automation Bot moved this from To triage to Done in awslabs/mcp Project Nov 3, 2026
finklen-amazon added a commit that referenced this pull request Nov 3, 2026
…DimensionValues

#4990 added the dimension_key argument, which getDimensionValues sends as
DimensionKey. List it in OPERATION_ARGUMENTS for getDimensionValues and give
it a reason, so it reaches that operation and is rejected on the operations
that would drop it, with pointers to listing values, a PRODUCT_ATTRIBUTE
group_by and a ProductAttributes filter leaf. The dimension reason now says
that tag, cost category and PRODUCT_ATTRIBUTE keys take their own leaf type.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants