mcp-wayback-machine
Version:
MCP server and CLI tool for interacting with the Wayback Machine without API keys
40 lines (36 loc) • 950 B
JavaScript
/**
* * Cache Management tool — clears the response cache.
*/
import * as z from "zod";
import { cachingFetcher } from "../utils/cache.js";
export const ClearCache = z.object({});
/**
* * Clear all cached API responses.
*/
export async function clearCache() {
try {
await cachingFetcher.clear();
return {
success: true,
message: "Cache cleared successfully",
};
}
catch (error) {
return {
success: false,
message: `Failed to clear cache: ${error instanceof Error ? error.message : "Unknown error"}`,
};
}
}
/**
* * Get cache status information.
*/
export function getCacheStatus() {
const stats = cachingFetcher.getStats();
return {
success: true,
message: `Cache contains ${String(stats.memoryEntries)} in-memory entries`,
memoryEntries: stats.memoryEntries,
};
}
//# sourceMappingURL=cache.js.map