@@ -1272,16 +1272,8 @@ def cloudflare_get_ddos_protection_settings(zone_id: str) -> dict[str, Any]:
12721272 if validation_error :
12731273 return validation_error
12741274
1275- # Note: DDoS settings are usually under rulesets with phase
1276- # 'http_ratelimit' or 'http_request_late_transform'. A general
1277- # config endpoint exists but may be limited.
1278- _make_request (
1279- "GET" ,
1280- f"/zones/{ zone_id } /settings/automatic_https_rewrites" ,
1281- token ,
1282- )
1283-
1284- return {"ddos_summary" : "DDoS protection is on by default; see WAF rulesets for details." }
1275+ result = _make_request ("GET" , f"/zones/{ zone_id } /ddos_protection/settings" , token )
1276+ return {"ddos_protection" : result }
12851277
12861278 @mcp .tool ("cloudflare_create_firewall_rule" )
12871279 def cloudflare_create_firewall_rule (
@@ -1538,6 +1530,10 @@ def cloudflare_list_advanced_services(zone_id: str) -> dict[str, Any]:
15381530 if isinstance (token , dict ):
15391531 return token
15401532
1533+ validation_error = _validate_zone_id (zone_id )
1534+ if validation_error :
1535+ return validation_error
1536+
15411537 # Note: Workers and Load Balancers often require account-level access
15421538 # but can be filtered by zone. Basic implementation here.
15431539 workers = _make_request ("GET" , f"/zones/{ zone_id } /workers/scripts" , token )
@@ -1568,18 +1564,23 @@ def cloudflare_list_accounts(page: int = 1, per_page: int = 20) -> dict[str, Any
15681564 return token
15691565
15701566 params = {"page" : page , "per_page" : min (per_page , 50 )}
1571- result = _make_request ("GET" , "/accounts" , token , params = params )
1567+ response = _make_request ("GET" , "/accounts" , token , params = params , full_response = True )
15721568
1573- if "error" in result :
1574- return result
1569+ if "error" in response :
1570+ return response
15751571
1572+ result = response .get ("result" , [])
1573+ result_info = response .get ("result_info" , {})
15761574 accounts = result if isinstance (result , list ) else result .get ("accounts" , [])
1575+
15771576 return {
15781577 "accounts" : [
15791578 {"id" : a .get ("id" ), "name" : a .get ("name" ), "status" : a .get ("status" )}
15801579 for a in accounts
15811580 ],
1582- "total" : len (accounts ),
1581+ "total" : result_info .get ("total_count" , result_info .get ("count" , len (accounts ))),
1582+ "page" : page ,
1583+ "per_page" : per_page ,
15831584 }
15841585
15851586 @mcp .tool ("cloudflare_get_account_details" )
@@ -1681,6 +1682,10 @@ def cloudflare_list_custom_hostnames(zone_id: str) -> dict[str, Any]:
16811682 if isinstance (token , dict ):
16821683 return token
16831684
1685+ validation_error = _validate_zone_id (zone_id )
1686+ if validation_error :
1687+ return validation_error
1688+
16841689 result = _make_request ("GET" , f"/zones/{ zone_id } /custom_hostnames" , token )
16851690 if "error" in result :
16861691 return result
@@ -1726,6 +1731,10 @@ def cloudflare_list_firewall_rules(zone_id: str) -> dict[str, Any]:
17261731 if isinstance (token , dict ):
17271732 return token
17281733
1734+ validation_error = _validate_zone_id (zone_id )
1735+ if validation_error :
1736+ return validation_error
1737+
17291738 result = _make_request (
17301739 "GET" ,
17311740 f"/zones/{ zone_id } /rulesets/phases/http_request_firewall_custom/entrypoint" ,
0 commit comments