Skip to main content
Glama
codefriar

Salesforce CLI MCP Server

sf_cache_refresh

Refresh Salesforce CLI command cache by re-scanning all available commands to ensure accurate command availability and functionality.

Instructions

Refresh the SF command cache by re-scanning all available commands

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • src/index.ts:34-46 (registration)
    Registration of the 'sf_cache_refresh' tool, including empty input schema and the inline handler function that calls refreshCommandCache() and returns a formatted text response.
    server.tool('sf_cache_refresh', 'Refresh the SF command cache by re-scanning all available commands', {}, async () => {
        const result = refreshCommandCache();
        return {
            content: [
                {
                    type: 'text',
                    text: result
                        ? 'Command cache refreshed successfully. Restart the server to use the new cache.'
                        : 'Failed to refresh command cache.',
                },
            ],
        };
    });
  • The MCP tool handler function for 'sf_cache_refresh' that invokes refreshCommandCache and formats success/error response.
    server.tool('sf_cache_refresh', 'Refresh the SF command cache by re-scanning all available commands', {}, async () => {
        const result = refreshCommandCache();
        return {
            content: [
                {
                    type: 'text',
                    text: result
                        ? 'Command cache refreshed successfully. Restart the server to use the new cache.'
                        : 'Failed to refresh command cache.',
                },
            ],
        };
    });
  • Core helper function that implements the cache refresh logic: deletes existing cache, fetches all SF commands via getAllSfCommands(), and saves new cache via saveCommandCache().
    export function refreshCommandCache(): boolean {
        try {
            // Clear existing cache
            if (fs.existsSync(CACHE_FILE)) {
                fs.unlinkSync(CACHE_FILE);
            }
    
            // Create a fresh cache
            console.error('Refreshing SF command cache...');
    
            // Get all commands directly from sf commands --json
            const commands = getAllSfCommands();
            console.error(`Found ${commands.length} total commands for cache refresh`);
    
            // Save the cache
            saveCommandCache(commands);
            console.error('Cache refresh complete!');
    
            return true;
        } catch (error) {
            console.error('Error refreshing command cache:', error);
            return false;
        }
    }
  • List of reserved tool names that are excluded from dynamic SF command registration to avoid conflicts.
    const reservedTools = ['sf_cache_clear', 'sf_cache_refresh'];
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the tool refreshes the cache by re-scanning commands, implying a read/write operation that updates cache state, but doesn't specify permissions needed, side effects, performance impact, or error handling. For a tool that likely modifies cache data, 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 a single, efficient sentence that directly states the tool's action without unnecessary words. It is front-loaded with the core purpose ('Refresh the SF command cache') and adds clarifying detail ('by re-scanning all available commands'). Every part of the sentence contributes meaning, making it highly concise and well-structured.

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 has no parameters, no annotations, and no output schema, the description is minimal. While it states what the tool does, it lacks context about why or when to use it, behavioral traits like side effects or performance, and what the output might be. For a cache operation tool, this leaves significant gaps in understanding its role and impact.

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

Parameters4/5

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

The tool has 0 parameters, and schema description coverage is 100% (as there are no parameters to describe). The description doesn't need to add parameter semantics, so it meets the baseline of 4 for zero-parameter tools. No additional value is required beyond stating the tool's purpose.

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 verb ('Refresh') and resource ('SF command cache'), and specifies the action ('by re-scanning all available commands'). It distinguishes from sibling 'sf_cache_clear' by indicating a refresh rather than a clear operation. However, it doesn't explicitly differentiate from other siblings like project directory tools, keeping it at 4 rather than 5.

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 'sf_cache_clear' or other cache-related operations. It lacks context about prerequisites, timing, or scenarios where this refresh is necessary versus other actions. This leaves the agent without usage direction.

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/codefriar/sf-mcp'

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