Skip to main content
Glama

logout

End your session on the eClass platform to secure your account and complete your interaction with the MCP server.

Instructions

Log out from eClass

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
random_stringYesDummy parameter for no-parameter tools

Implementation Reference

  • The main handler function for the 'logout' tool, which calls authentication helpers to perform logout and format the response.
    async def handle_logout() -> List[types.TextContent]: """Handle logout from eClass.""" success, username_or_error = authentication.perform_logout(session_state) return [authentication.format_logout_response(success, username_or_error)]
  • Registration of the 'logout' tool in the list_tools handler, including name, description, and input schema.
    types.Tool( name="logout", description="Log out from eClass", inputSchema={ "type": "object", "properties": { "random_string": { "type": "string", "description": "Dummy parameter for no-parameter tools" }, }, "required": ["random_string"], }, ),
  • Input schema definition for the 'logout' tool (uses dummy parameter since no real inputs are needed).
    inputSchema={ "type": "object", "properties": { "random_string": { "type": "string", "description": "Dummy parameter for no-parameter tools" }, }, "required": ["random_string"],
  • Helper function that performs the actual logout by making a GET request to the logout URL and resetting session state.
    def perform_logout(session_state: SessionState) -> Tuple[bool, Optional[str]]: """ Log out from eClass. Returns: Tuple of (success, username_or_error). On success with prior login: (True, username) On success without prior login: (True, None) On failure: (False, error_message) """ if not session_state.logged_in: return True, None try: response = session_state.session.get(session_state.logout_url) response.raise_for_status() username = session_state.username session_state.reset() return True, username except Exception as e: logger.error(f"Logout error: {e}") return False, f"Error during logout: {e}"
  • Helper function to format the logout response as MCP TextContent.
    def format_logout_response( success: bool, username_or_error: Optional[str] ) -> types.TextContent: """Format logout response for MCP.""" if success: if username_or_error: return types.TextContent( type="text", text=f"Successfully logged out user {username_or_error}.", ) return types.TextContent( type="text", text="Not logged in, nothing to do.", ) return types.TextContent( type="text", text=f"Error during logout: {username_or_error}", )
Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/sdi2200262/eclass-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server