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
| Name | Required | Description | Default |
|---|---|---|---|
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.', }, ] }; });
- src/sfCommands.ts:82-96 (handler)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; } }