You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 3dea6e0
Browse filesBrowse the repository at this point in the historyBrowse files
fix(billing-cost-management-mcp-server): send filter for getTagsOrValues and getCostCategories
cost-explorer accepted `filter` for getTagsOrValues and getCostCategories but
never sent it, so a filtered call returned the unfiltered list as a success.
Both APIs take Filter and apply it: the lists keep only the keys, names or
values found on matching costs.
- Forward filter to GetTags and GetCostCategories (keys and values).
- Describe filter for both operations and their limit: an And of leaves
only; Or, Not and a nested And are rejected by the service.
- Extend the Tags leaves section and the response hint for a user: key or a
group_by label to both operations: they now apply the filter, and there
too a user: key with Values matches nothing (with ABSENT, every cost).
Both also reject an empty Tags key, like getDimensionValues.
- Treat filter '""' (or a blank JSON string) as empty, like ''.
- cost-comparison: call a blank filter empty, before creating the client.
- group_by '[]' means no grouping on operations without GroupBy, as it does
in getCostAndUsage. A group_by that is not JSON is still rejected there as
not supported.
Copy file name to clipboardExpand all lines: src/billing-cost-management-mcp-server/awslabs/billing_cost_management_mcp_server/tools/cost_comparison_tools.py
Copy file name to clipboardExpand all lines: src/billing-cost-management-mcp-server/awslabs/billing_cost_management_mcp_server/tools/cost_explorer_operations.py
Copy file name to clipboardExpand all lines: src/billing-cost-management-mcp-server/awslabs/billing_cost_management_mcp_server/tools/cost_explorer_tools.py
+65-36Lines changed: 65 additions & 36 deletions
Original file line number
Diff line number
Diff line change
@@ -18,7 +18,12 @@
18
18
"""
19
19
20
20
importjson
21
-
from ..utilities.aws_service_baseimportcreate_aws_client, format_response, handle_aws_error
21
+
from ..utilities.aws_service_baseimport (
22
+
create_aws_client,
23
+
format_response,
24
+
handle_aws_error,
25
+
parse_json,
26
+
)
22
27
from ..utilities.constantsimportPAGINATION_LIMIT_TEXT
Defaults: If start_date is omitted, the tool uses 30 days before today; if end_date is omitted, it uses today (exclusive, so today is not included).
265
273
Example 1: {"operation": "getTagsOrValues"}
266
274
Example 2: {"operation": "getTagsOrValues", "tag_key": "Environment"}
267
-
Returns: List of available cost allocation tags (see PAGINATION). If tag values for a particular key are needed, pass the tag key as a parameter. The tag key list holds at most 5,000 keys in total.
275
+
Returns: List of available cost allocation tags (see PAGINATION). If tag values for a particular key are needed, pass the tag key as a parameter. The tag key list holds at most 5,000 keys in total. A filter keeps only the keys (or values) found on costs that match it, e.g. the tags used in one Region.
268
276
269
277
7. getCostCategories - Available cost categories or values inside a category
Example 2 (list values inside a category): {"operation": "getCostCategories", "cost_category_name": "CostCenters", "start_date": "__SIX_MONTHS_AGO_START__", "end_date": "__MONTH_START__"}
275
-
Notes: Without cost_category_name the response contains CostCategoryNames. With cost_category_name set the response contains CostCategoryValues for that category. The category name list holds at most 5,000 names in total. See PAGINATION.
283
+
Notes: Without cost_category_name the response contains CostCategoryNames. With cost_category_name set the response contains CostCategoryValues for that category. The category name list holds at most 5,000 names in total. A filter keeps only the names (or values) found on costs that match it. See PAGINATION.
276
284
277
285
8. getSavingsPlansUtilization - Savings Plans utilization data
Copy file name to clipboardExpand all lines: src/billing-cost-management-mcp-server/awslabs/billing_cost_management_mcp_server/utilities/aws_service_base.py
+4-3Lines changed: 4 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -233,8 +233,9 @@ def parse_filter(
233
233
) ->Any:
234
234
"""Parse a filter expression, rejecting an empty one.
235
235
236
-
An empty filter (``''``, ``{}``, ``[]``, ``null``) is an error rather than "no filter":
237
-
dropping it would run the query unfiltered, and the result would read as a filtered one.
236
+
An empty filter (``''``, ``""`` or another blank JSON string, ``{}``, ``[]``, ``null``)
237
+
is an error rather than "no filter": dropping it would run the query unfiltered, and the
238
+
result would read as a filtered one.
238
239
239
240
Args:
240
241
filter_expr: The filter, as an object or a JSON string. None means no filter.
0 commit comments