Skip to content

Commit ccd1ff4

Browse files
committed
docstring
Signed-off-by: Rakhi Dutta <rakhibiswas@yahoo.com>
1 parent 8ecc899 commit ccd1ff4

2 files changed

Lines changed: 29 additions & 0 deletions

File tree

mcpgateway/admin.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10127,6 +10127,19 @@ async def admin_unified_search(
1012710127
}
1012810128

1012910129
async def _safe_entity_search(search_callable, empty_key: str, **kwargs: Any) -> dict[str, Any]:
10130+
"""Safely execute entity search, returning empty results on auth errors.
10131+
10132+
Args:
10133+
search_callable: Async function to call for searching entities
10134+
empty_key: Key name for empty results list in response
10135+
**kwargs: Additional arguments to pass to search_callable
10136+
10137+
Returns:
10138+
Search results dict, or empty results dict on 401/403 errors
10139+
10140+
Raises:
10141+
HTTPException: Re-raises non-auth HTTP exceptions
10142+
"""
1013010143
try:
1013110144
return await search_callable(**kwargs)
1013210145
except HTTPException as exc:

mcpgateway/schemas.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -760,6 +760,14 @@ def extract_base_url_and_populate_schemas(cls, values: dict) -> dict:
760760
# 2. It has no properties defined (empty properties dict)
761761
# 3. It's the default factory value
762762
def is_empty_schema(schema):
763+
"""Check if a JSON schema is empty or has no properties defined.
764+
765+
Args:
766+
schema: JSON schema dict to check
767+
768+
Returns:
769+
True if schema is None, empty dict, or has no properties
770+
"""
763771
if not schema or schema == {}:
764772
return True
765773
# Check if it's a schema with empty properties
@@ -1309,6 +1317,14 @@ def extract_base_url_and_populate_schemas(cls, values: dict) -> dict:
13091317

13101318
# Determine if schemas need population
13111319
def is_empty_schema(schema):
1320+
"""Check if a JSON schema is empty or has no properties defined.
1321+
1322+
Args:
1323+
schema: JSON schema dict to check
1324+
1325+
Returns:
1326+
True if schema is None, empty dict, or has no properties
1327+
"""
13121328
if not schema or schema == {}:
13131329
return True
13141330
if isinstance(schema, dict):

0 commit comments

Comments
 (0)