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 8abaec6
Browse filesBrowse the repository at this point in the historyBrowse files
fix(billing-cost-management-mcp-server): map each service's bad-token code to invalid_next_token (#4861)
* fix(billing-cost-management-mcp-server): map each service's bad-token code to invalid_next_token
Only Cost Explorer, Budgets and the Price List API report a rejected
pagination token as InvalidNextTokenException. The other paged services
use a generic code: ValidationException (Billing views, billing
preferences, credits, enterprise support, Invoicing, Billing Conductor,
Cost Optimization Hub, Free Tier, Savings Plans, Pricing Calculator) or
InvalidParameterValueException (Compute Optimizer Automation). A bogus or
expired next_token on those tools came back as the generic code with the
"correct your arguments" hint instead of invalid_next_token and the
"restart without next_token" hint.
Each of those operations' PageSpec now names its service's code in
caller_token_error_codes, the mechanism Compute Optimizer and the Billing
Group cost report already use. The code is read as a rejected token only
when the caller sent next_token, on the first request; elsewhere it stays
the service's own error.
* fix(billing-cost-management-mcp-server): require a generic bad-token code to name the token
A generic code such as ValidationException also reports other invalid
arguments. With a caller next_token, a service can still reject another
argument first (ListBillingViews checks arns before the token), and the
helper reported that as invalid_next_token. A caller_token_error_codes
code now counts as a rejected token only when the error message names
the token. GetBillingGroupCostReport keeps code-only matching, because
its expired-token InternalServerException need not name the token.
Copy file name to clipboardExpand all lines: src/billing-cost-management-mcp-server/awslabs/billing_cost_management_mcp_server/tools/bcm_pricing_calculator_tools.py
+4Lines changed: 4 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -49,6 +49,8 @@
49
49
token_key_in_response='nextToken',
50
50
page_max=25,
51
51
page_size_param='maxResults',
52
+
# The service reports a bad caller next_token as ValidationException.
Copy file name to clipboardExpand all lines: src/billing-cost-management-mcp-server/awslabs/billing_cost_management_mcp_server/tools/billing_conductor_operations.py
Copy file name to clipboardExpand all lines: src/billing-cost-management-mcp-server/awslabs/billing_cost_management_mcp_server/tools/billing_preferences_operations.py
Copy file name to clipboardExpand all lines: src/billing-cost-management-mcp-server/awslabs/billing_cost_management_mcp_server/tools/compute_optimizer_automation_operations.py
Copy file name to clipboardExpand all lines: src/billing-cost-management-mcp-server/awslabs/billing_cost_management_mcp_server/tools/cost_optimization_hub_helpers.py
+6Lines changed: 6 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -54,20 +54,26 @@
54
54
token_key_in_response='nextToken',
55
55
page_max=1000,
56
56
page_size_param='maxResults',
57
+
# The service reports a bad caller next_token as ValidationException.
Copy file name to clipboardExpand all lines: src/billing-cost-management-mcp-server/awslabs/billing_cost_management_mcp_server/tools/credits_operations.py
+2Lines changed: 2 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -64,6 +64,8 @@
64
64
token_key_in_response='nextToken',
65
65
page_max=500,
66
66
page_size_param='maxResults',
67
+
# The service reports a bad caller next_token as ValidationException.
Copy file name to clipboardExpand all lines: src/billing-cost-management-mcp-server/awslabs/billing_cost_management_mcp_server/tools/enterprise_support_operations.py
+2Lines changed: 2 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -56,6 +56,8 @@
56
56
token_key_in_response='nextToken',
57
57
page_max=100,
58
58
page_size_param='maxResults',
59
+
# The service reports a bad caller next_token as ValidationException.
Copy file name to clipboardExpand all lines: src/billing-cost-management-mcp-server/awslabs/billing_cost_management_mcp_server/tools/free_tier_usage_tools.py
+2Lines changed: 2 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -37,6 +37,8 @@
37
37
token_key_in_response='nextToken',
38
38
page_max=1000,
39
39
page_size_param='maxResults',
40
+
# The service reports a bad caller next_token as ValidationException.
Copy file name to clipboardExpand all lines: src/billing-cost-management-mcp-server/awslabs/billing_cost_management_mcp_server/tools/invoice_units_operations.py
+2Lines changed: 2 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -43,6 +43,8 @@
43
43
token_key_in_response='NextToken',
44
44
page_max=500,
45
45
page_size_param='MaxResults',
46
+
# The service reports a bad caller next_token as ValidationException.
0 commit comments