Skip to main content
Glama

elenchus_clear_cache

Clear cached verification results to force fresh adversarial code analysis using the Verifier-Critic debate loop. Requires explicit confirmation.

Instructions

Clear all cached verification results. Requires confirm: true.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
confirmYesConfirm cache clear operation

Implementation Reference

  • The clearCacheTool handler function that executes the tool logic. It checks the 'confirm' argument, and if true, calls clearCache() from the cache module and returns a success response. Otherwise returns an error message.
    export async function clearCacheTool(
      args: z.infer<typeof ClearCacheSchema>
    ): Promise<{
      success: boolean;
      message: string;
    }> {
      if (!args.confirm) {
        return {
          success: false,
          message: 'Cache clear not confirmed. Set confirm: true to proceed.'
        };
      }
    
      await clearCache();
    
      return {
        success: true,
        message: 'Cache cleared successfully'
      };
    }
  • The ClearCacheSchema validation schema using Zod, requiring a 'confirm' boolean field.
    export const ClearCacheSchema = z.object({
      confirm: z.boolean().describe('Confirm cache clear operation')
    });
  • Registration of the 'elenchus_clear_cache' tool in the cacheTools object, mapping it to the ClearCacheSchema and clearCacheTool handler.
    export const cacheTools = {
      elenchus_get_cache_stats: {
        description: 'Get cache statistics including hit rate, total entries, and token savings.',
        schema: GetCacheStatsSchema,
        handler: getCacheStatsTool
      },
      elenchus_clear_cache: {
        description: 'Clear all cached verification results. Requires confirm: true.',
        schema: ClearCacheSchema,
        handler: clearCacheTool
      }
    };
  • The composed 'tools' export that includes all cacheTools (including elenchus_clear_cache) via spread operator.
    export const tools = {
      ...sessionLifecycleTools,
      ...issueManagementTools,
      ...mediatorTools,
      ...roleTools,
      ...reverifyTools,
      ...diffTools,
      ...cacheTools,
      ...pipelineTools,
      ...safeguardsTools,
      ...optimizationTools,
      ...dynamicRoleTools,
      ...llmEvalTools,
    };
  • The clearCache helper function that deletes all .json cache files from disk and resets the in-memory cache index and stats.
    export async function clearCache(config: CacheConfig = DEFAULT_CACHE_CONFIG): Promise<void> {
      const cacheDir = config.storagePath || DEFAULT_CACHE_DIR;
    
      try {
        const files = await fs.readdir(cacheDir);
        for (const file of files) {
          if (file.endsWith('.json')) {
            await fs.unlink(path.join(cacheDir, file));
          }
        }
        cacheIndex.clear();
        stats = {
          totalEntries: 0,
          hitCount: 0,
          missCount: 0,
          hitRate: 0,
          averageAge: 0,
          totalTokensSaved: 0,
          storageSize: 0
        };
      } catch (error) {
        console.error('[Elenchus Cache] Error clearing:', error);
      }
    }
Behavior2/5

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

No annotations are present, so the description must fully disclose behavioral traits. It only states the action and the confirmation requirement, but does not discuss effects on ongoing operations, irreversibility, or required permissions.

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

Conciseness4/5

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

The description is very short (two sentences) and front-loaded with the purpose. It is efficient, though could benefit from minimal structure like bullet points for clarity.

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 no output schema, the description does not explain what the tool returns or confirm success/failure. It also lacks context on side effects or whether the operation is reversible. For a destructive action, more completeness is needed.

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

Parameters2/5

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

Schema coverage is 100%, and the description's mention of 'Requires confirm: true' adds no new meaning beyond what the schema's parameter description already provides. It simply restates the requirement.

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

Purpose5/5

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

The description clearly states the action ('Clear all cached verification results') with a specific verb and resource. It distinguishes from siblings like `elenchus_get_cache_stats` which is for reading, while this tool is for clearing.

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

Usage Guidelines3/5

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

The description mentions the requirement for confirm: true, which provides some usage guidance. However, it does not specify when to use this tool over alternatives or mention any prerequisites or side effects.

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/jhlee0409/elenchus-mcp'

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