oauth-logout
Remove stored OAuth tokens to log out from MediaWiki wikis. Omit the wiki key to log out from all wikis.
Instructions
Removes stored OAuth tokens. With no argument, removes all stored tokens; with wiki, removes only that wiki. Stdio only.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| wiki | No | Wiki key to log out from. Omit to log out from all wikis. |
Implementation Reference
- src/tools/oauth-logout.ts:25-44 (handler)The handle() function that executes the oauth-logout tool logic. Reads the token store, identifies target wiki(s), deletes tokens, and returns the list of removed keys. Guards against non-stdio transport.
async handle({ wiki }, ctx: ToolContext): Promise<CallToolResult> { // Defense in depth: the reconcile rule already hides this tool on HTTP, // but a forced direct invocation must not delete from the local credentials file. if (ctx.transport !== 'stdio') { return ctx.format.invalidInput('oauth-logout is only available on the stdio transport.'); } const store = createTokenStore(); const cur = await store.read(); const targets = typeof wiki === 'string' ? [wiki] : Object.keys(cur.tokens); const removed: string[] = []; for (const key of targets) { if (cur.tokens[key]) { await store.delete(key); removed.push(key); ctx.logger.info('', { event: 'oauth_token_revoked', wiki: key }); } } return ctx.format.ok({ removed }); }, }; - src/tools/oauth-logout.ts:7-9 (schema)Input schema for oauth-logout: an optional 'wiki' string parameter. If omitted, logs out from all wikis.
const inputSchema = { wiki: z.string().optional().describe('Wiki key to log out from. Omit to log out from all wikis.'), } as const; - src/tools/index.ts:35-35 (registration)Import of oauthLogout from ./oauth-logout.js.
import { oauthLogout } from './oauth-logout.js'; - src/tools/index.ts:62-63 (registration)oauthLogout is included in the standardTools array, which is registered via register() in registerAllTools.
oauthStatus, oauthLogout, - src/runtime/dispatcher.ts:22-28 (helper)oauth-logout is listed in TOOLS_BYPASSING_ACTIVE_WIKI_AUTH, meaning it skips OAuth token acquisition for the active wiki.
const TOOLS_BYPASSING_ACTIVE_WIKI_AUTH: ReadonlySet<string> = new Set([ 'add-wiki', 'set-wiki', 'remove-wiki', 'oauth-status', 'oauth-logout', ]);