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"]
      }
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure. It states the tool performs removal/clearing operations (implying destructive changes) but doesn't specify whether this requires authentication, what the side effects are (e.g., data loss), error conditions, or what happens after execution. For a tool with clear destructive potential, this is insufficient behavioral context.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise (one sentence) and front-loaded with the core functionality. Every word earns its place by clearly stating the two possible operations without any redundant information or unnecessary elaboration.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (destructive operations with 4 parameters) and lack of annotations or output schema, the description is incomplete. It doesn't explain what 'clear the token store' means in practice, what confirmation or results to expect, or how this interacts with authentication systems. For a tool that modifies persistent state, more context about behavior and consequences is needed.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema has 100% description coverage, so all parameters are documented in the schema itself. The description adds no additional parameter semantics beyond what's already in the schema properties. The baseline score of 3 reflects adequate but minimal value added by the description regarding parameters.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose with specific verbs ('Remove' and 'clear') and resources ('specific user' and 'token store'). It distinguishes between two related operations but doesn't explicitly differentiate from sibling tools like 'delete' or 'list_user', which would require more specific context about what makes this tool unique for user/token management.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'delete' or 'list_user' from the sibling list. It mentions two operations (remove specific user vs clear all) but lacks context about prerequisites, typical scenarios, or exclusions that would help an agent decide when this is the appropriate choice.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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