Skip to main content
Glama
zhiwei5576

Excel MCP Server

by zhiwei5576

clearFileCache

Clear the cached data for an Excel file by providing its absolute path. This forces the server to re-read the file on the next request.

Instructions

Clear cached data for the specified Excel file

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
fileAbsolutePathYesThe absolute path of the Excel file to clear from cache

Implementation Reference

  • Handler function for clearFileCache tool. Normalizes the file path, then calls workbookCache.delete() to remove the cached workbook. Returns success/error JSON responses.
    async (params: { fileAbsolutePath: string }) => {
        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"
                    })
                }]
            };
        }
    }
  • Input schema for clearFileCache: requires 'fileAbsolutePath' (string) describing the absolute path of the Excel file to clear from cache.
    {
        fileAbsolutePath: z.string().describe("The absolute path of the Excel file to clear from cache")
    },
  • Registration of the 'clearFileCache' tool via server.tool() with description and input schema, exported as part of cacheTools function.
    export const cacheTools = (server: any) => {
        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: { fileAbsolutePath: string }) => {
                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"
                            })
                        }]
                    };
                }
            }
        );
  • src/index.ts:25-25 (registration)
    Invocation of cacheTools(server) to register all cache-related tools including clearFileCache on the MCP server.
    cacheTools(server);   
  • The delete() method on WorkbookCache class that actually removes the cached workbook entry by file path. Returns boolean indicating whether deletion occurred.
    delete(filePathWithName: string): boolean {
      if (!this.cache.has(filePathWithName)) return false
      return this.cache.delete(filePathWithName)
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure. It only states 'clears cached data', which is already implied by the tool name. It fails to explain what 'cached data' entails, whether clearing is permanent or reversible, any side effects on other files or users, or required permissions. The description adds minimal value beyond the name.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a concise single sentence of 7 words, efficiently conveying the core action. It is appropriately sized for a simple tool, though additional context could be added without becoming verbose. It is well-structured and front-loaded with the action.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's simplicity (one parameter, no output schema, no annotations), the description is incomplete. It does not explain when cache clearing is needed, whether it affects other users, if it is idempotent, or what the expected effect on subsequent operations is. For a mapping/caching tool, users need more context to use it correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100% (the single parameter 'fileAbsolutePath' has a clear schema description). The tool description does not add any extra meaning beyond what the schema already provides. Per criteria, baseline is 3 when schema coverage is high, and no additional parameter context is given.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool clears cached data for a specified Excel file, with a specific verb 'clear' and resource 'cached data for Excel file'. This distinguishes it from sibling tools that focus on reading, writing, or analyzing Excel structure, leaving no ambiguity about its function.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives, when not to use it, or any prerequisite conditions. Among siblings, there is no explicit caching tool, but no context is given about scenarios where cache clearing is beneficial (e.g., after file updates or for performance).

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

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