Skip to main content
Glama

sf_cache_refresh

Refresh the Salesforce CLI command cache by re-scanning all available commands, ensuring accurate and up-to-date command execution for AI agents and tools interacting with Salesforce orgs.

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)
    Registers the sf_cache_refresh tool with the MCP server. The inline handler calls refreshCommandCache() and formats the 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.', }, ], }; });
  • Main handler logic for refreshing the SF command cache: clears existing cache, fetches all 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; } }
  • Lists sf_cache_refresh as a reserved tool to prevent dynamic registration conflicts during SF command discovery.
    const reservedTools = ['sf_cache_clear', 'sf_cache_refresh'];

Other Tools

Related 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