cache
Manage cache operations for Android development, including clearing data, viewing statistics, and configuring settings to optimize performance.
Instructions
Manage the cache. See rtfm for details.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| operation | Yes | ||
| key | No | Key to clear (optional) | |
| config | No |
Implementation Reference
- src/tools/cache.ts:17-50 (handler)The handleCacheTool function processes the cache operation requests by delegating to the CacheManager instance.
export async function handleCacheTool( input: CacheInput, cache: CacheManager ): Promise<Record<string, unknown>> { switch (input.operation) { case "get-stats": return { stats: cache.getStats() }; case "clear": if (input.key) { cache.clear(input.key); return { cleared: input.key }; } else { cache.clearAll(); return { cleared: "all" }; } case "get-config": return { config: cache.getConfig() }; case "set-config": if (input.config) { cache.setConfig(input.config); } return { config: cache.getConfig() }; default: throw new ReplicantError( ErrorCode.INVALID_OPERATION, `Unknown operation: ${input.operation}`, "Valid operations: get-stats, clear, get-config, set-config", ); } } - src/tools/cache.ts:5-13 (schema)Zod schema for validating the cache tool input.
export const cacheInputSchema = z.object({ operation: z.enum(["get-stats", "clear", "get-config", "set-config"]), key: z.string().optional(), config: z.object({ maxEntries: z.number().optional(), maxEntrySizeBytes: z.number().optional(), defaultTtlMs: z.number().optional(), }).optional(), }); - src/tools/cache.ts:52-80 (registration)Definition of the 'cache' tool for MCP registration.
export const cacheToolDefinition = { name: "cache", description: "Manage the cache. See rtfm for details.", inputSchema: { type: "object", properties: { operation: { type: "string", enum: ["get-stats", "clear", "get-config", "set-config"], }, key: { type: "string", description: "Key to clear (optional)" }, config: { type: "object", properties: { maxEntries: { type: "number" }, maxEntrySizeBytes: { type: "number" }, defaultTtlMs: { type: "number" }, }, }, }, required: ["operation"], }, annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: false, openWorldHint: false, }, };