auth_logout
End the current user session to log out from the Magento MCP Server. This action destroys session data for secure account management.
Instructions
Destroy the current session.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| params | No | Action parameters as a JSON object |
Implementation Reference
- src/actions/auth.ts:90-95 (handler)The handler function for auth.logout that destroys the session by calling sessionStore.destroy() and returns a success message or 'No active session' if no session existed.
handler: async (_params: Record<string, unknown>, context: ActionContext) => { const destroyed = sessionStore.destroy(context.sessionId); return { message: destroyed ? 'Logged out successfully' : 'No active session', }; }, - src/actions/auth.ts:85-96 (registration)Tool registration defining auth.logout with name, description ('Destroy the current session.'), risk tier (Safe), and requiresAuth flag (true). The handler is the async function that executes the logout logic.
{ name: 'auth.logout', description: 'Destroy the current session.', riskTier: RiskTier.Safe, requiresAuth: true, handler: async (_params: Record<string, unknown>, context: ActionContext) => { const destroyed = sessionStore.destroy(context.sessionId); return { message: destroyed ? 'Logged out successfully' : 'No active session', }; }, }, - src/index.ts:76-78 (registration)MCP tool registration where action.name 'auth.logout' is converted to 'auth_logout' by replacing dots with underscores, making it the tool name exposed via MCP protocol.
for (const action of allActions) { // Convert dots to underscores for MCP tool names (e.g. "auth.login" -> "auth_login") const toolName = action.name.replace(/\./g, '_'); - src/session/sessionStore.ts:61-63 (helper)The SessionStore.destroy() method that removes the session from the in-memory Map, returning true if the session existed and was deleted, false otherwise.
destroy(sessionId: string): boolean { return this.sessions.delete(sessionId); }