Skip to main content
Glama
codefriar

Salesforce CLI MCP Server

sf_cache_clear

Clear cached Salesforce CLI command metadata to force a refresh when commands appear outdated or malfunctioning.

Instructions

Clear the cached SF command metadata to force a refresh

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • src/index.ts:20-32 (registration)
    Registers the sf_cache_clear tool with an inline async handler that calls clearCommandCache() and formats the response.
    server.tool('sf_cache_clear', 'Clear the cached SF command metadata to force a refresh', {}, async () => {
        const result = clearCommandCache();
        return {
            content: [
                {
                    type: 'text',
                    text: result
                        ? 'Command cache cleared successfully.'
                        : 'Failed to clear command cache or cache did not exist.',
                },
            ]
        };
    });
  • The helper function that implements the cache clearing logic by deleting the cache file at CACHE_FILE path.
    export function clearCommandCache(): boolean {
        try {
            if (fs.existsSync(CACHE_FILE)) {
                fs.unlinkSync(CACHE_FILE);
                console.error(`Removed cache file: ${CACHE_FILE}`);
                return true;
            } else {
                console.error(`Cache file does not exist: ${CACHE_FILE}`);
                return false;
            }
        } catch (error) {
            console.error('Error clearing command cache:', error);
            return false;
        }
    }

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