8000 feat: Add sortByColumn functionality to List Operation · google/adk-python@af95dd2 · GitHub
[go: up one dir, main page]

Skip to content
8000

Commit af95dd2

Browse files
google-genai-botcopybara-github
authored andcommitted
feat: Add sortByColumn functionality to List Operation
This change introduces the ability to sort results by a specific column in the List Operation. PiperOrigin-RevId: 766468964
1 parent eb2b9ef commit af95dd2

File tree

4 files changed

+15
-6
lines changed

4 files changed

+15
-6
lines changed

src/google/adk/tools/application_integration_tool/clients/connections_client.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,12 @@ def get_connector_base_spec() -> Dict[str, Any]:
252252
"Timeout in seconds for execution of custom query"
253253
),
254254
},
255+
"sortByColumns": {
256+
"type": "array",
257+
"items": {"type": "string"},
258+
"default": [],
259+
"description": "Column to sort the results by",
260+
},
255261
"connectorOutputPayload": {"type": "object"},
256262
"nextPageToken": {"type": "string"},
257263
"execute-connector_Response": {
@@ -665,6 +671,7 @@ def list_operation_request() -> Dict[str, Any]:
665671
"serviceName": {"$ref": "#/components/schemas/serviceName"},
666672
"host": {"$ref": "#/components/schemas/host"},
667673
"entity": {"$ref": "#/components/schemas/entity"},
674+
"sortByColumns": {"$ref": "#/components/schemas/sortByColumns"},
668675
"dynamicAuthConfig": {
669676
"$ref": "#/components/schemas/dynamicAuthConfig"
670677
},

src/google/adk/tools/application_integration_tool/integration_connector_tool.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,7 @@ class IntegrationConnectorTool(BaseTool):
6464
'dynamic_auth_config',
6565
]
6666

67-
OPTIONAL_FIELDS = [
68-
'page_size',
69-
'page_token',
70-
'filter',
71-
]
67+
OPTIONAL_FIELDS = ['page_size', 'page_token', 'filter', 'sortByColumns']
7268

7369
def __init__(
7470
self,

tests/unittests/tools/application_integration_tool/clients/test_connections_client.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -511,6 +511,7 @@ def test_list_operation_request(self):
511511
assert schema["type"] == "object"
512512
assert "properties" in schema
513513
assert "filterClause" in schema["properties"]
514+
assert "sortByColumns" in schema["properties"]
514515

515516
def test_action_request(self):
516517
schema = ConnectionsClient.action_request("TestAction")

tests/unittests/tools/application_integration_tool/test_integration_connector_tool.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,11 @@ async def test_run_with_auth_async_none_token(
157157
integration_tool_with_auth, mock_rest_api_tool
158158
):
159159
"""Tests run_async when auth credential token is None."""
160-
input_args = {"user_id": "user456", "filter": "some_filter"}
160+
input_args = {
161+
"user_id": "user456",
162+
"filter": "some_filter",
163+
"sortByColumns": ["a", "b"],
164+
}
161165
expected_call_args = {
162166
"user_id": "user456",
163167
"filter": "some_filter",
@@ -168,6 +172,7 @@ async def test_run_with_auth_async_none_token(
168172
"entity": "TestEntity",
169173
"operation": "LIST",
170174
"action": "TestAction",
175+
"sortByColumns": ["a", "b"],
171176
}
172177

173178
with mock.patch(

0 commit comments

Comments
 (0)
0