clear_cache
Clear the cached documentation for MTA:SA functions by specifying a function name or 'all' to remove all cached data.
Instructions
Clear the MTA:SA documentation cache for a specific function or all functions.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| function_name | Yes | Function name to clear cache for, or 'all' to clear everything |
Implementation Reference
- src/index.ts:737-774 (handler)Handler function for the 'clear_cache' tool. If function_name is 'all', it clears all docs via queries.clearAllDocs().run(). Otherwise, it normalizes the function name, resolves it via findMetadataByName, and clears cache for that specific function via queries.clearDoc().run(targetName).
async ({ function_name }): Promise<CallToolResult> => { if (function_name.trim().toLowerCase() === "all") { queries.clearAllDocs().run(); return { content: [ { type: "text", text: `Cleared all cached MTA:SA documents`, }, ], }; } const normalizedName = normalizeFunctionInput(function_name); if (!normalizedName) { return { content: [ { type: "text", text: "Function name is required.", }, ], }; } const resolved = findMetadataByName(normalizedName); const targetName = resolved?.name ?? normalizedName; queries.clearDoc().run(targetName); return { content: [ { type: "text", text: `Cleared cache for ${targetName}`, }, ], }; }, - src/index.ts:723-775 (registration)Registration of the 'clear_cache' tool on the MCP server, including its description and input schema (function_name string).
// Register tool: clear_cache server.registerTool( "clear_cache", { description: "Clear the MTA:SA documentation cache for a specific function or all functions.", inputSchema: { function_name: z .string() .describe( "Function name to clear cache for, or 'all' to clear everything", ), }, }, async ({ function_name }): Promise<CallToolResult> => { if (function_name.trim().toLowerCase() === "all") { queries.clearAllDocs().run(); return { content: [ { type: "text", text: `Cleared all cached MTA:SA documents`, }, ], }; } const normalizedName = normalizeFunctionInput(function_name); if (!normalizedName) { return { content: [ { type: "text", text: "Function name is required.", }, ], }; } const resolved = findMetadataByName(normalizedName); const targetName = resolved?.name ?? normalizedName; queries.clearDoc().run(targetName); return { content: [ { type: "text", text: `Cleared cache for ${targetName}`, }, ], }; }, ); - src/database/queries.ts:104-107 (helper)The clearDoc query definition – a prepared SQL DELETE statement that removes a single function's cached documentation from function_docs by function_name.
clearDoc: () => db.prepare(` DELETE FROM function_docs WHERE function_name = ? `), - src/database/queries.ts:109-112 (helper)The clearAllDocs query definition – a prepared SQL DELETE statement that removes all cached documentation from the function_docs table.
clearAllDocs: () => db.prepare(` DELETE FROM function_docs `), - src/index.ts:62-64 (helper)The normalizeFunctionInput helper used by the handler to normalize user-provided function names before cache clearing.
const normalizeFunctionInput = (value: string): string => { return canonicalizeFunctionName(value.trim()); };