clear-exchange-cache
Clear cached exchange instances in the CCXT MCP Server to ensure updated configurations are applied promptly for cryptocurrency exchange integrations.
Instructions
Clear exchange instance cache to apply configuration changes
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {},
"type": "object"
}
Implementation Reference
- src/tools/config.ts:157-182 (handler)Registration and inline handler for the 'clear-exchange-cache' tool. Calls clearExchangeCache() from exchange manager and returns a success or error response.server.tool("clear-exchange-cache", "Clear exchange instance cache to apply configuration changes", {}, async () => { try { clearExchangeCache(); return { content: [{ type: "text", text: JSON.stringify({ success: true, message: "Exchange cache cleared successfully", note: "New exchange instances will be created with current configuration" }, null, 2) }] }; } catch (error) { log(LogLevel.ERROR, `Error clearing exchange cache: ${error instanceof Error ? error.message : String(error)}`); return { content: [{ type: "text", text: `Error: ${error instanceof Error ? error.message : String(error)}` }], isError: true }; } } );
- src/exchange/manager.ts:32-37 (helper)Core helper function that implements the cache clearing logic by deleting all entries from the exchanges cache object.export function clearExchangeCache(): void { Object.keys(exchanges).forEach(key => { delete exchanges[key]; }); log(LogLevel.INFO, 'Exchange cache cleared'); }