Skip to main content
Glama
Xuzan9396

YST KPI Daily Report Collector

by Xuzan9396

clear_saved_cookies

Clears saved cookies to reset session state and require re-authentication, maintaining secure access for automated KPI report collection.

Instructions

清除已保存的 Cookie

Returns: 清除结果

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The async function clear_saved_cookies() decorated with @mcp.tool() — the handler that clears saved cookies by delegating to CookieManager.clear_cookies()
    @mcp.tool()
    async def clear_saved_cookies() -> str:
        """
        清除已保存的 Cookie
    
        Returns:
            清除结果
        """
        manager = CookieManager()
    
        try:
            if manager.clear_cookies():
                return safe_text("✓ Cookie 已清除")
            else:
                return safe_text("❌ 清除失败")
        except Exception as e:
            return safe_text(f"清除失败: {str(e)}")
  • server.py:301-301 (registration)
    The @mcp.tool() decorator registers clear_saved_cookies as an MCP tool on the FastMCP instance 'yst-mcp'
    @mcp.tool()
  • CookieManager.clear_cookies() — the helper method that deletes the cookies.json file from disk
    def clear_cookies(self) -> bool:
        """
        清除保存的 Cookie
    
        Returns:
            是否清除成功
        """
        if os.path.exists(self.cookie_file):
            try:
                os.remove(self.cookie_file)
                return True
            except Exception as e:
                print(f"清除 Cookie 失败: {e}")
                return False
        return True
  • CookieManager.__init__() — constructor that determines the cookie file path (either user home directory or project data directory)
    def __init__(self, cookie_file: str = None):
        """
        初始化 Cookie 管理器
    
        Args:
            cookie_file: Cookie 保存文件路径(可选,默认使用自动检测的路径)
        """
        if cookie_file is None:
            base_dir = self._get_base_dir()
            self.cookie_file = str(base_dir / 'cookies.json')
        else:
            self.cookie_file = cookie_file
        self._ensure_data_dir()
  • CookieManager._get_base_dir() — static method that resolves the base data directory (user home vs project directory) where cookies.json is stored
    @staticmethod
    def _get_base_dir() -> Path:
        """
        获取基础数据目录
    
        打包后使用用户主目录 ~/.yst_mcp/data/
        开发时使用项目目录 ./data/
    
        Returns:
            数据目录路径
        """
        if getattr(sys, 'frozen', False):
            # 打包后:使用用户主目录
            return Path.home() / '.yst_mcp' / 'data'
        else:
            # 开发时:使用项目目录
            return Path(__file__).parent / 'data'
Behavior2/5

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

No annotations provided. The description only states the return value as 'clear result' without detailing what exactly is cleared (e.g., domain-specific, all cookies) or side effects. For a zero-annotation tool, this is insufficient.

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

Conciseness3/5

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

The description is very brief at two lines, but lacks structure (no sections, formatting) and is minimally informative. While not verbose, it sacrifices usefulness for brevity.

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 0-parameter tool with an output schema, the description should at least clarify the nature of 'clear result' (e.g., success/error content, count of cleared cookies). Without annotations, the description leaves significant gaps in understanding the tool's behavior and output.

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

Parameters4/5

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

Input schema has no parameters, so 100% coverage. Baseline for 0 parameters is 4. Description does not add parameter info, but schema already covers completely.

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 name and description clearly state the action 'clear' and resource 'saved cookies'. It distinguishes from siblings like save_cookies_from_browser (opposite) and browser_login (different operation).

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?

No guidance on when to use this tool versus alternatives like clearing cookies via a login flow or using other cookie management tools. The description implies a simple clearing action but provides no context-appropriate or exclusionary information.

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/Xuzan9396/yst_mcp'

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