Skip to content

Commit 81b8067

Browse files
Prem Ramanathanharanrk
authored andcommitted
fix: api-registry to fetch all services
API Registry no longer supports enabling apis. To get all the apis, one needs to pass an additional filter to fetch the apis. This allows the library to fetch all available apis. Closes #5478 Co-authored-by: Haran Rajkumar <haranrk@google.com> PiperOrigin-RevId: 933840827
1 parent 910e1c1 commit 81b8067

2 files changed

Lines changed: 8 additions & 5 deletions

File tree

src/google/adk/integrations/api_registry/api_registry.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,10 @@ def __init__(
6161
page_token = None
6262
with httpx.Client() as client:
6363
while True:
64-
params = {}
64+
params = {
65+
# Include all the apis including disabled ones. API registry no longer supports enabling APIs.
66+
"filter": "enabled=false"
67+
}
6568
if page_token:
6669
params["pageToken"] = page_token
6770

tests/unittests/integrations/api_registry/test_api_registry.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ def test_init_success(self, MockHttpClient):
9191
"Authorization": "Bearer mock_token",
9292
"Content-Type": "application/json",
9393
},
94-
params={},
94+
params={"filter": "enabled=false"},
9595
)
9696

9797
@patch("httpx.Client", autospec=True)
@@ -120,7 +120,7 @@ def test_init_with_quota_project_id_success(self, MockHttpClient):
120120
"Content-Type": "application/json",
121121
"x-goog-user-project": "quota-project",
122122
},
123-
params={},
123+
params={"filter": "enabled=false"},
124124
)
125125

126126
@patch("httpx.Client", autospec=True)
@@ -176,15 +176,15 @@ def test_init_with_pagination_success(self, MockHttpClient):
176176
"Authorization": "Bearer mock_token",
177177
"Content-Type": "application/json",
178178
},
179-
params={},
179+
params={"filter": "enabled=false"},
180180
)
181181
mock_client_instance.get.assert_called_with(
182182
f"https://cloudapiregistry.googleapis.com/v1beta/projects/{self.project_id}/locations/{self.location}/mcpServers",
183183
headers={
184184
"Authorization": "Bearer mock_token",
185185
"Content-Type": "application/json",
186186
},
187-
params={"pageToken": "next_page_token"},
187+
params={"filter": "enabled=false", "pageToken": "next_page_token"},
188188
)
189189

190190
@patch("httpx.Client", autospec=True)

0 commit comments

Comments
 (0)