Skip to main content
Glama

clear_user

Remove specific users or clear all authentication tokens from storage to manage access control and maintain security.

Instructions

Remove a specific user or clear the token store

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
folderYesFolder where the token file is stored
fileNoOptional token file name (default: tokens.json)
user_titleNoSpecific user title to remove. If omitted, all users are removed.
preserveDefaultNoWhen clearing all users, keep the 'default' user entry if it exists

Implementation Reference

  • The handler for the 'clear_user' tool in the CallToolRequestSchema switch statement. It reads the token store from the specified folder/file, removes the specified user_title or clears all (optionally preserving 'default'), updates the file, and returns the result or error.
    case "clear_user": { const folder = String(args?.folder || ''); const file = args?.file ? String(args.file) : undefined; const userTitle = args?.user_title ? String(args.user_title) : undefined; const preserveDefault = Boolean(args?.preserveDefault); if (!folder) { throw new Error("folder is required to clear users from the token store"); } try { const { filePath, tokens } = readTokenStore(folder, file); let updatedTokens = tokens; let message: string | undefined; if (userTitle) { const remaining = tokens.filter((entry) => entry?.user_title_name !== userTitle); const removedCount = tokens.length - remaining.length; if (removedCount === 0) { message = `No entry found for user_title '${userTitle}' in ${filePath}`; } updatedTokens = remaining; } else { updatedTokens = preserveDefault ? tokens.filter((entry) => entry?.user_title_name === 'default') : []; if (preserveDefault && tokens.some((entry) => entry?.user_title_name === 'default')) { message = `Cleared all users except default from ${filePath}`; } } writeTokenStore(filePath, folder, updatedTokens); const responsePayload = { file: filePath, users: updatedTokens, message: message || (userTitle ? `Removed user '${userTitle}' from ${filePath}` : `Cleared token store at ${filePath}`) }; return { content: [{ type: "text", text: JSON.stringify(responsePayload, null, 2) }] }; } catch (error) { const errorMessage = error instanceof Error ? error.message : String(error); return { content: [{ type: "text", text: JSON.stringify( { error: 'Unable to clear user(s) from token store', details: errorMessage }, null, 2 ) }] }; } }
  • The input schema definition for the 'clear_user' tool, returned in the ListTools response. Defines parameters: folder (required), file, user_title, preserveDefault.
    { name: "clear_user", description: "Remove a specific user or clear the token store", inputSchema: { type: "object", properties: { folder: { type: "string", description: "Folder where the token file is stored" }, file: { type: "string", description: "Optional token file name (default: tokens.json)" }, user_title: { type: "string", description: "Specific user title to remove. If omitted, all users are removed." }, preserveDefault: { type: "boolean", description: "When clearing all users, keep the 'default' user entry if it exists" } }, required: ["folder"] } }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/vilasone455/api-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server