authstatus
Check if you're logged into eClass to access course materials and perform platform 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:214-217 (handler)The main handler function for the 'authstatus' tool, which calls the authentication helper to generate the response.async def handle_authstatus() -> List[types.TextContent]: """Handle checking authentication status.""" return [authentication.format_authstatus_response(session_state)]
- src/eclass_mcp_server/server.py:140-153 (registration)Registration of the 'authstatus' tool in the @server.list_tools() handler, defining its name, description, and input schema.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"], }, ),
- Input schema for the 'authstatus' tool, which uses a dummy 'random_string' parameter since the tool takes no real inputs.inputSchema={ "type": "object", "properties": { "random_string": { "type": "string", "description": "Dummy parameter for no-parameter tools" }, }, "required": ["random_string"], },
- Helper function that generates the formatted text response for authentication status based on the session state.def format_authstatus_response(session_state: SessionState) -> types.TextContent: """Format authentication status response for MCP.""" if not session_state.logged_in: return types.TextContent( type="text", text="Status: Not logged in", ) if session_state.is_session_valid(): return types.TextContent( type="text", text=f"Status: Logged in as {session_state.username}\nCourses: {len(session_state.courses)} enrolled", ) return types.TextContent( type="text", text="Status: Session expired. Please log in again.", )