sign_out
Sign out users from AWS Cognito to terminate active sessions and revoke authentication tokens, ensuring secure session management.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- index.ts:123-158 (handler)Handler function that retrieves the current Cognito user, signs them out using cognitoUser.signOut(), and returns appropriate success or no-user messages.async ({ }) => { const cognitoUser = userPool.getCurrentUser(); if (cognitoUser) { const username = cognitoUser.getUsername(); cognitoUser.signOut(); return { content: [ { type: "text" as const, text: "Signed out successfully", }, { type: "text" as const, text: `Username: ${username}`, }, { type: "text" as const, text: `Time: ${new Date().toISOString()}`, }, { type: "text" as const, text: "All tokens have been invalidated", } ] }; } else { return { content: [ { type: "text" as const, text: "No user was signed in", } ] }; } }
- index.ts:121-122 (schema)Empty input schema for the 'sign_out' tool, indicating no parameters required.{ },
- index.ts:119-159 (registration)Registration of the 'sign_out' tool via server.tool() call, including empty schema and inline handler.server.tool( "sign_out", { }, async ({ }) => { const cognitoUser = userPool.getCurrentUser(); if (cognitoUser) { const username = cognitoUser.getUsername(); cognitoUser.signOut(); return { content: [ { type: "text" as const, text: "Signed out successfully", }, { type: "text" as const, text: `Username: ${username}`, }, { type: "text" as const, text: `Time: ${new Date().toISOString()}`, }, { type: "text" as const, text: "All tokens have been invalidated", } ] }; } else { return { content: [ { type: "text" as const, text: "No user was signed in", } ] }; } } )