jp_lit_delete_cache
Delete cached search data from Japanese literature databases by cache key or tool to free storage and refresh results.
Instructions
ローカル保存されたキャッシュを cache_key 単位または tool 単位で削除する
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| tool | Yes | ||
| cache_key | Yes | ||
| clear_all | Yes | ||
| deleted_count | Yes | ||
| deleted | Yes | ||
| message | Yes |
Implementation Reference
- src/tools/jpLitDeleteCache.ts:8-45 (handler)Handler function for jp_lit_delete_cache tool. Accepts input with tool name, optional cache_key, and optional clear_all flag. If clear_all is true, clears all cache entries for the tool; else if cache_key specified, deletes that single entry. Returns structured output with deleted count and status message.
export function createJpLitDeleteCacheTool(cache: FileCache) { return async (input: unknown) => { const parsed = deleteCacheInputSchema.parse(input); let deletedCount = 0; let deleted = false; if (parsed.clear_all) { deletedCount = await cache.clear(parsed.tool); deleted = deletedCount > 0; } else if (parsed.cache_key) { deleted = await cache.delete(parsed.tool, parsed.cache_key); deletedCount = deleted ? 1 : 0; } const structuredContent: DeleteCacheOutput = deleteCacheOutputSchema.parse({ tool: parsed.tool, cache_key: parsed.cache_key ?? null, clear_all: parsed.clear_all, deleted_count: deletedCount, deleted, message: parsed.clear_all ? `${parsed.tool} のキャッシュを ${deletedCount} 件削除しました` : deleted ? `cache_key=${parsed.cache_key} を削除しました` : `cache_key=${parsed.cache_key} は見つかりませんでした` }); return { content: [ { type: "text" as const, text: JSON.stringify(structuredContent, null, 2) } ], structuredContent }; }; }