Skip to content

feat: add unlock_user tool for unlocking locked-out accounts#29

Open
pm-bhatt wants to merge 1 commit intookta:mainfrom
pm-bhatt:account-unlock
Open

feat: add unlock_user tool for unlocking locked-out accounts#29
pm-bhatt wants to merge 1 commit intookta:mainfrom
pm-bhatt:account-unlock

Conversation

@pm-bhatt
Copy link
Copy Markdown

@pm-bhatt pm-bhatt commented Feb 25, 2026

Summary

  • Adds a new unlock_user MCP tool that unlocks Okta user accounts with LOCKED_OUT status, returning them to ACTIVE so they can sign in with their existing password
  • Calls the Okta SDK's POST /api/v1/users/{userId}/lifecycle/unlock endpoint
  • Includes input validation via @validate_ids, structured error handling, and logging consistent with existing tools

Changes

File Description
src/okta_mcp_server/tools/users/users.py New unlock_user tool function
tests/conftest.py Added unlock_user mock to shared mock_okta_client fixture
tests/elicitation/test_users_elicitation.py 3 new tests: success, API error, exception
README.md Documented unlock_user in the Users tools table

Design Decisions

  • No elicitation confirmation — Unlocking restores access (non-destructive), similar to activate_application and activate_policy which also proceed without confirmation
  • Return type list — Matches existing user lifecycle tools (deactivate_user, delete_deactivated_user)

Test plan

  • test_unlock_success — verifies SDK call and success message
  • test_unlock_okta_api_error — verifies Okta API errors are surfaced
  • test_unlock_exception — verifies generic exceptions are handled gracefully
  • All 121 tests pass (uv run pytest)
  • No new lint issues (uv run ruff check)

Add a new MCP tool that unlocks Okta user accounts with LOCKED_OUT
status, returning them to ACTIVE so they can sign in with their
existing password. Includes input validation, tests, and README docs.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@pm-bhatt
Copy link
Copy Markdown
Author

Hey @releng-internal-okta - can you please approve ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant