mmnt_cache
Retrieve cached web pages from Mamont search engine. Specify a unique cache ID and choose to extract text-only or full HTML content.
Instructions
Extract page from Mamont cache
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | unique cache id | |
| onlyText | Yes | Should the result be text only (no html) |
Implementation Reference
- src/mmnt/cache.ts:10-21 (handler)The main handler function extractCache that fetches the HTML from Mamont cache, decodes it, and optionally extracts text using cheerio.export async function extractCache(id: string, onlyText: boolean = true): Promise<string> { const response = await fetch(`https://www.mmnt.ru/cache2/${id}.html`); const buffer = await response.arrayBuffer(); const html = iconv.decode(Buffer.from(buffer), "windows-1251"); // convert win1251 -> utf8 if (!onlyText) { return html; } const $ = cheerio.load(html); return $("pre").first().text(); }
- src/types.ts:18-21 (schema)Zod schema for CacheParams defining the input parameters: id (string) and onlyText (boolean).export const CacheParams = { id: z.string({description: "unique cache id"}), onlyText: z.boolean({description: "Should the result be text only (no html)"}) };
- src/index.ts:27-37 (registration)Registration of the mmnt_cache tool using McpServer.tool, specifying name, description, input schema (CacheParams), and handler that calls extractCache.server.tool( "mmnt_cache", "Extract page from Mamont cache", CacheParams, async ({id, onlyText}) => ({ content: [{ type: "text", text: JSON.stringify(await extractCache(id, onlyText)) }] }) );