Skip to main content
Glama

Excel MCP Server

by zhiwei5576
MIT License
99
41
  • Linux
  • Apple
cacheTools.js1.86 kB
import { z } from "zod"; import { normalizePath } from "../utils/utils.js"; import { workbookCache } from "../utils/workbookCache.js"; export const cacheTools = (server) => { server.tool("clearFileCache", 'Clear cached data for the specified Excel file', { fileAbsolutePath: z.string().describe("The absolute path of the Excel file to clear from cache") }, async (params) => { try { const normalizedPath = await normalizePath(params.fileAbsolutePath); if (normalizedPath === 'error') { return { content: [{ type: "text", text: JSON.stringify({ error: `Invalid file path: ${params.fileAbsolutePath}`, suggestion: "Please verify the file path and name" }) }] }; } const deleted = workbookCache.delete(normalizedPath); return { content: [{ type: "text", text: JSON.stringify({ success: true, message: deleted ? `Cache cleared successfully for file: ${normalizedPath}` : `No cache found for file: ${normalizedPath}` }) }] }; } catch (error) { return { content: [{ type: "text", text: JSON.stringify({ error: `Failed to clear cache: ${error}`, suggestion: "Please verify the file path" }) }] }; } }); };

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/zhiwei5576/excel-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server