Skip to main content
Glama

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'];

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