Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions src/okta_mcp_server/tools/system_logs/system_logs.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,23 @@
except Exception as _patch_err:
logger.warning(f"Could not apply userBehaviors workaround: {_patch_err}")

# Workaround for SDK model strictness: allow extra fields and make all fields optional in
# Application models to prevent a single bad record from poisoning the entire response.
try:
import pydantic
from okta.models.application import Application

# Make Application model permissive: allow extra fields and make all fields optional.
for field_name, field_info in Application.model_fields.items():
if field_info.is_required():
field_info.default = None
field_info.annotation = _typing.Optional[field_info.annotation]
Application.model_config['extra'] = 'allow'
Application.model_rebuild(force=True)
logger.debug("Applied permissive config for Application model (workaround for strict validation)")
except Exception as _patch_err:
logger.warning(f"Could not apply Application model workaround: {_patch_err}")


@mcp.tool()
@require_scopes("okta.logs.read")
Expand Down