authstatus
Verify authentication status for AI agents on the Open eClass platform via UoA's SSO system, ensuring secure access to course data and operations.
Instructions
Check authentication status with eClass
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| random_string | Yes | Dummy parameter for no-parameter tools |
Implementation Reference
- src/eclass_mcp_server/server.py:145-155 (registration)Registers the 'authstatus' tool in the list_tools handler, specifying name, description, and a dummy input schema for no-parameter tool.types.Tool( name="authstatus", description="Check authentication status with eClass", inputSchema={ "type": "object", "properties": { "random_string": {"type": "string", "description": "Dummy parameter for no-parameter tools"}, }, "required": ["random_string"], }, ),
- src/eclass_mcp_server/server.py:227-231 (handler)The primary handler function for the 'authstatus' tool, which delegates to the authentication helper to format and return the status response.async def handle_authstatus() -> List[types.TextContent]: """Handle checking authentication status.""" # Use the authentication module to format the status response return [authentication.format_authstatus_response(session_state)]
- src/eclass_mcp_server/server.py:171-172 (handler)Tool dispatcher in the call_tool handler that routes 'authstatus' requests to the specific handle_authstatus function.elif name == "authstatus": return await handle_authstatus()
- Helper function that formats the authentication status response, checking login state and session validity, and returns the appropriate TextContent.def format_authstatus_response(session_state) -> types.TextContent: """ Format authentication status response. Args: session_state: The current session state Returns: Formatted MCP TextContent response """ if not session_state.logged_in: return types.TextContent( type="text", text="Status: Not logged in", ) # Check if session is still valid is_valid = session_state.is_session_valid() if is_valid: return types.TextContent( type="text", text=f"Status: Logged in as {session_state.username}\nCourses: {len(session_state.courses)} enrolled", ) else: return types.TextContent( type="text", text="Status: Session expired. Please log in again.", )