fix: get_gear uses numeric userProfilePk, complete_mfa resets state on timeout

This commit is contained in:
Christophe Vila
2026-05-17 19:59:10 +02:00
parent a8879e84dd
commit 944353d7a0
2 changed files with 10 additions and 4 deletions

View File

@@ -97,7 +97,8 @@ def complete_mfa(code: str) -> str:
return "MFA accepted. Authenticated successfully."
return f"Authentication failed after MFA: {err}"
except queue.Empty:
return "Timed out waiting for authentication to complete."
_auth_state = "unauthenticated"
return "Timed out waiting for authentication to complete. Call authenticate() again."
@mcp.tool()
@@ -288,7 +289,11 @@ def get_gear() -> str:
if err := _check_auth():
return err
try:
result = _client.get_gear(_client.display_name)
profile = _client.get_user_profile()
user_id = profile.get("userId") or profile.get("id")
if not user_id:
return "Could not determine user profile ID required for gear lookup."
result = _client.get_gear(str(user_id))
if not result:
return "No gear found."
return json.dumps(result, indent=2)