Skip to main content
Glama
longhz

MiniMax MCP Server

by longhz

clear_vision_cache

Clears the image understanding cache by forcing cached data from memory to disk and returns updated cache statistics.

Instructions

清除图片理解缓存(手动触发)

将内存中的缓存数据强制写入磁盘,并返回当前缓存统计。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • MCP tool registration for 'clear_vision_cache' - decorated with @mcp.tool(), imports and delegates to the real handler in image_understand.py
    # ═══════════════════════════════════════════════════════════
    # Tool 5: 清除视觉分析缓存
    # ═══════════════════════════════════════════════════════════
    
    @mcp.tool()
    def clear_vision_cache() -> dict:
        """清除图片理解缓存(手动触发)
    
        将内存中的缓存数据强制写入磁盘,并返回当前缓存统计。
        """
        from minimax_mcp.tools.image_understand import clear_vision_cache as _run
        return _run()
  • Handler function for clear_vision_cache - calls flush_cache() to persist in-memory cache to disk and returns cache stats
    def clear_vision_cache() -> dict:
        """清除视觉分析缓存(手动触发)"""
        flush_cache()
        return {"success": True, "message": "Vision cache flushed to disk", "stats": get_cache_stats()}
  • Helper functions get_cache_stats() and flush_cache() that delegate to the global VisionCache instance
    def get_cache_stats() -> dict:
        """获取缓存统计"""
        return _get_cache().stats()
    
    
    def flush_cache():
        """强制刷缓存到磁盘"""
        _get_cache().flush()
  • VisionCache.flush() method - public method that forces the in-memory cache to be written to disk
    def flush(self):
        """强制刷盘"""
        self._flush()
  • VisionCache._flush() internal method - writes cached entries to a JSON file atomically (via .tmp file + replace)
    def _flush(self):
        if not self._dirty:
            return
        try:
            data = {
                "updated": time.time(),
                "entries": list(self._memory.items()),
            }
            self._disk_path.parent.mkdir(parents=True, exist_ok=True)
            tmp = self._disk_path.with_suffix(".tmp")
            tmp.write_text(json.dumps(data, ensure_ascii=False, indent=2), encoding="utf-8")
            tmp.replace(self._disk_path)
            self._dirty = False
        except Exception:
            pass  # 磁盘写入失败不影响主流程
Behavior3/5

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

No annotations are provided, so the description must carry the burden. It discloses that it flushes cache to disk and returns statistics, but doesn't clarify if the cache is cleared (destructive) or just persisted, leaving some ambiguity about side effects.

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 two sentences, focused, and front-loaded. Every word contributes meaning with no fluff.

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

Completeness4/5

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

For a tool with no parameters and no output schema, the description is fairly complete: it explains the action and what is returned. However, it lacks detail about the statistics returned, such as format or contents.

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

Parameters5/5

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

There are no parameters, so the schema fully covers them. The description adds value by stating that the tool returns cache statistics, which is not in the schema.

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 the image understanding cache, force writes to disk, and returns statistics. It identifies the specific resource and action, and is distinct from sibling tools like generate_image or understand_image.

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

Usage Guidelines3/5

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

The description says 'manual trigger' implying on-demand use, but does not provide explicit guidance on when to use this tool versus others or when not to use it. Usage is implied but not fully elaborated.

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/longhz/minimax-mcp'

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