Skip to main content
Glama
zhiwei5576

Excel MCP Server

by zhiwei5576

clearFileCache

Clear cached data for a specified Excel file to resolve performance issues or outdated information by removing stored temporary files.

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

  • The handler function for the clearFileCache tool. Normalizes the absolute file path, checks validity, deletes the file's data from workbookCache if present, and returns a structured text response with success status or error details.
    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"
                    })
                }]
            };
        }
    }
  • Zod input schema defining the required 'fileAbsolutePath' parameter as a string with descriptive metadata.
    fileAbsolutePath: z.string().describe("The absolute path of the Excel file to clear from cache")
  • Direct registration of the 'clearFileCache' tool on the MCP server, specifying name, description, input schema, and inline handler function.
    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)
    Top-level invocation of cacheTools function to register cache-related tools, including 'clearFileCache', on the main MCP server instance.
    cacheTools(server);   
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the tool clears cached data, which implies a mutation operation, but doesn't specify whether this is destructive, reversible, or has side effects. It also doesn't mention permissions needed, rate limits, or what happens after clearing (e.g., does it trigger re-caching?). For a mutation tool with zero annotation coverage, this leaves significant behavioral gaps.

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

Conciseness5/5

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

The description is a single, efficient sentence that directly states the tool's purpose without any unnecessary words. It's appropriately sized and front-loaded with the core action, making it easy to parse quickly.

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?

For a mutation tool (clearing cache) with no annotations and no output schema, the description is insufficiently complete. It doesn't explain what 'cached data' entails, whether the operation is safe or destructive, what the expected outcome is, or how to verify success. Given the complexity of cache operations and lack of structured metadata, the description should provide more contextual detail.

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?

The schema description coverage is 100%, with the single parameter 'fileAbsolutePath' fully documented in the schema. The description doesn't add any additional meaning beyond what the schema provides about this parameter. Since the schema does the heavy lifting, the baseline score of 3 is appropriate.

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

Purpose4/5

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

The description clearly states the action ('Clear cached data') and the target resource ('for the specified Excel file'), making the tool's purpose immediately understandable. It doesn't explicitly differentiate from sibling tools, but since siblings are about reading/writing Excel data rather than cache management, the distinction is implicit rather than explicit.

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, nor does it mention prerequisites or typical scenarios for cache clearing. While the tool's purpose suggests it should be used when cached Excel data needs to be refreshed, this is implied rather than explicitly stated as usage guidance.

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