auth_logout
Terminate the current authenticated session to log out from Magento.
Instructions
Destroy the current session.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| params | No | Action parameters as a JSON object |
Implementation Reference
- src/actions/auth.ts:85-95 (handler)The `auth.logout` action handler — calls `sessionStore.destroy(context.sessionId)` to destroy the current session and returns a success or 'No active session' message.
{ 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/session/sessionStore.ts:61-63 (helper)The `SessionStore.destroy()` method — deletes the session from the in-memory Map and returns a boolean indicating whether it existed.
destroy(sessionId: string): boolean { return this.sessions.delete(sessionId); } - src/index.ts:51-61 (registration)The tool registration in `src/index.ts`: `createAuthActions(sessionStore)` is spread into the `allActions` array, and then each action is registered as an MCP tool via `mcpServer.tool(toolName, ...)` where `auth.logout` becomes `auth_logout`.
const allActions: ActionDefinition[] = [ ...createAuthActions(sessionStore), ...createScopeActions(sessionStore), ...createPromotionsActions(planStore, guardrails, config), ...createCatalogActions(planStore, guardrails, idempotencyLedger, config), ...createPricingActions(planStore, guardrails, idempotencyLedger, config), ...createCmsActions(planStore, guardrails, config), ...createSeoActions(planStore, guardrails, config), ...createDiagnosticsActions(), ...createCacheActions(guardrails, config), ];