sign_out
Log out users from AWS Cognito sessions to terminate authentication and secure access control.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- index.ts:123-158 (handler)The handler function retrieves the current Cognito user, signs them out using cognitoUser.signOut(), and returns success or no-user messages with details.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)Input schema for the sign_out tool: empty object, indicating no input parameters are required.{ },
- index.ts:119-159 (registration)Full registration of the sign_out tool via server.tool(), specifying the name, empty input schema, and inline handler function.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", } ] }; } } )