swit-oauth-logout
Log out from OAuth authentication and delete stored tokens to enable re-authentication for the Swit MCP Server.
Instructions
Logout from OAuth authentication and delete stored tokens. Use when re-authentication is required.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/handlers/oauth.handlers.ts:47-60 (handler)The main execution logic for the 'swit-oauth-logout' tool. Checks if the OAuth web server is available, invokes logout on the OAuth manager, and returns a success response.export const handleOAuthLogout = async (oauthWebServer: OAuthWebServer | null) => { if (!oauthWebServer) { return { error: 'OAuth web server is not available. Cannot perform logout.', }; } oauthWebServer.getOAuthManager().logout(); return { message: 'OAuth logout completed successfully.', note: 'Cached tokens have been cleared. Use swit-oauth-start to re-authenticate.', }; };
- src/tools/oauth.tools.ts:17-21 (schema)Tool schema definition including name, description, and empty input schema (no parameters required).{ name: 'swit-oauth-logout', description: 'Logout from OAuth authentication and delete stored tokens. Use when re-authentication is required.', inputSchema: zodToJsonSchema(EmptySchema), },
- src/handlers/oauth.handlers.ts:62-66 (registration)Factory function creating the handlers object that maps 'swit-oauth-logout' to its execution function.export const oauthHandlers = (oauthWebServer: OAuthWebServer | null) => ({ 'swit-oauth-status': () => handleOAuthStatus(oauthWebServer), 'swit-oauth-start': () => handleOAuthStart(oauthWebServer), 'swit-oauth-logout': () => handleOAuthLogout(oauthWebServer), });
- src/index.ts:109-109 (registration)Registers the OAuth handlers (including 'swit-oauth-logout') into the global toolHandlers map used by the MCP server's CallToolRequestSchema handler.toolHandlers = { ...oauthHandlers(oauthWebServer), ...coreHandlers(switClient) };
- src/index.ts:61-63 (registration)Registers the listTools handler that exposes the tool schemas, including 'swit-oauth-logout', to MCP clients.server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools: [...oauthTools, ...coreTools] }; });