refresh_prices
Force a re-fetch of pricing data from the LiteLLM registry to update stale cache.
Instructions
Force a re-fetch of pricing data from the LiteLLM registry. Use this if you suspect the cached data is stale.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/pricing.ts:131-143 (handler)The actual refreshPrices function that fetches pricing data from the LiteLLM registry, caches it in memory and on disk, and returns the count and timestamp of loaded models.
export async function refreshPrices(): Promise<{ count: number; timestamp: string; }> { const models = await fetchFromSource(); const timestamp = Date.now(); cache = { timestamp, models }; saveDiskCache(cache); return { count: Object.keys(models).length, timestamp: new Date(timestamp).toISOString(), }; } - src/tools.ts:74-84 (registration)The tool registration entry for 'refresh_prices' in the tools array, defining its name, description, and input schema (no parameters required).
{ name: "refresh_prices", description: "Force a re-fetch of pricing data from the LiteLLM registry. Use this if you suspect the cached data is stale.", inputSchema: { type: "object" as const, properties: {}, required: [], }, }, ]; - src/tools.ts:412-422 (handler)The executeTool case handler for 'refresh_prices' that calls refreshPrices() and formats the response.
case "refresh_prices": { const result = await refreshPrices(); return { content: [ { type: "text", text: `Pricing data refreshed successfully.\nModels loaded: ${result.count}\nTimestamp: ${result.timestamp}`, }, ], }; } - src/tools.ts:78-83 (schema)Input schema for refresh_prices: an empty object with no required properties.
inputSchema: { type: "object" as const, properties: {}, required: [], }, }, - src/index.ts:21-28 (registration)The MCP server registers the tools via ListToolsRequestSchema handler which returns the tools array, enabling the 'refresh_prices' tool to be listed and called.
server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools }; }); server.setRequestHandler(CallToolRequestSchema, async (request) => { const { name, arguments: args } = request.params; return executeTool(name, args); });