Skip to main content
Glama

sf_cache_clear

Clear cached Salesforce CLI command metadata to refresh and ensure up-to-date command execution and data management.

Instructions

Clear the cached SF command metadata to force a refresh

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The execution handler for the sf_cache_clear tool. It calls clearCommandCache() from sfCommands.ts and returns a formatted text response indicating success or failure.
    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 core helper function that implements the cache clearing logic by deleting the command cache JSON file at ~/.sf-mcp/command-cache.json.
    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; } }
  • src/index.ts:20-32 (registration)
    Registers the sf_cache_clear tool on the MCP server with no input schema and the handler function.
    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.', }, ] }; });
  • Marks sf_cache_clear as a reserved tool name to prevent conflicts with dynamically registered SF CLI command tools.
    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