Skip to main content
Glama
CoderDayton

verifiable-thinking-mcp

clear_session

Clear session data to free memory in the verifiable-thinking-mcp server. Remove specific or all sessions using session_id or all parameters.

Instructions

Clear session(s) to free memory

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
session_idNoSession ID to clear (omit for all)
allYesClear all sessions

Implementation Reference

  • Main handler for clear_session tool. Exports clearSessionTool with name 'clear_session', description, zod schema for parameters (session_id optional, all boolean), and execute function that clears either a specific session or all sessions using SessionManager.clear/clearAll and clearTracker helpers.
    export const clearSessionTool = {
      name: "clear_session",
      description: "Clear session(s) to free memory",
      parameters: z.object({
        session_id: z.string().optional().describe("Session ID to clear (omit for all)"),
        all: z.boolean().default(false).describe("Clear all sessions"),
      }),
      execute: async (args: { session_id?: string; all?: boolean }) => {
        let result: string;
    
        if (args.all) {
          const count = SessionManager.clearAll();
          result = `Cleared ${count} session(s).`;
        } else if (!args.session_id) {
          result = "Provide session_id or set all=true";
        } else {
          // Also clear concept tracker for this session
          clearTracker(args.session_id);
    
          const cleared = SessionManager.clear(args.session_id);
          result = cleared
            ? `Cleared session: ${args.session_id}`
            : `Session not found: ${args.session_id}`;
        }
    
        const tokens = calculateTokenUsage(args, result);
        return `${result}\n\n---\n_tokens: ${tokens.input_tokens} in, ${tokens.output_tokens} out, ${tokens.total_tokens} total_`;
      },
    };
  • Zod schema defining input parameters for clear_session tool: session_id (optional string) and all (boolean default false).
    parameters: z.object({
      session_id: z.string().optional().describe("Session ID to clear (omit for all)"),
      all: z.boolean().default(false).describe("Clear all sessions"),
    }),
  • src/index.ts:24-24 (registration)
    Registers clearSessionTool with the FastMCP server using server.addTool(clearSessionTool).
    server.addTool(clearSessionTool);
  • SessionManager.clear() and clearAll() methods used by clear_session tool to remove sessions from memory.
    clear(sessionId: string): boolean {
      // Clear active session tracking if this is the active session
      if (this.activeSessionId === sessionId) {
        this.activeSessionId = null;
      }
      return this.sessions.delete(sessionId);
    }
    
    clearAll(): number {
      const count = this.sessions.size;
      this.sessions.clear();
      // Also clear the active session tracking
      this.activeSessionId = null;
      return count;
    }
  • clearTracker() helper function that removes the concept tracker for a specific session when clearing.
    export function clearTracker(sessionId: string): void {
      trackers.delete(sessionId);
    }
Behavior2/5

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

No annotations are provided, so the description carries the full burden. It mentions 'free memory', which hints at a destructive operation, but fails to disclose critical behavioral traits such as whether clearing is reversible, what data is lost, permission requirements, or side effects. This is inadequate for a tool that likely modifies state.

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 a single, efficient sentence with zero waste. It's front-loaded with the core action and purpose, making it easy to parse quickly. Every word earns its place without redundancy.

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 operation with 2 parameters) and lack of annotations or output schema, the description is incomplete. It doesn't cover behavioral risks, return values, or error conditions, leaving significant gaps for the agent to operate safely and effectively.

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?

Schema description coverage is 100%, so the schema fully documents both parameters. The description adds no additional meaning beyond implying that clearing sessions frees memory, but it doesn't explain parameter interactions (e.g., how 'session_id' and 'all' relate) or usage nuances. Baseline 3 is appropriate as the schema does the heavy lifting.

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 'Clear session(s) to free memory' clearly states the action (clear) and resource (session(s)), with a specific purpose (free memory). It distinguishes from siblings like 'get_session' or 'list_sessions' by indicating a destructive operation, though it doesn't explicitly contrast with 'scratchpad' or 'compress'.

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?

No guidance is provided on when to use this tool versus alternatives like 'scratchpad' or 'compress', which might also manage memory. The description implies usage for freeing memory but lacks explicit context, prerequisites, or exclusions, leaving the agent to infer based on general knowledge.

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/CoderDayton/verifiable-thinking-mcp'

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