Skip to main content
Glama
Xuzan9396

YST KPI Daily Report Collector

by Xuzan9396

check_login_status

Verify login status for the YST KPI Daily Report Collector to determine if authentication is required before data collection.

Instructions

检查当前登录状态(建议第一步调用)

✅ 推荐工作流程:

  1. 首先调用此工具检查登录状态

  2. 如果返回"未登录",则调用 browser_login 进行登录

  3. 登录成功后,调用 collect_reports 采集数据

Returns: 登录状态信息: - "✓ 已登录,Cookie 有效" -> 可以直接采集数据 - "❌ Cookie 已过期" -> 需要调用 browser_login 重新登录 - "❌ 未找到保存的 Cookie" -> 需要调用 browser_login 首次登录

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The main handler function for the 'check_login_status' MCP tool, decorated with @mcp.tool() for registration. It checks if cookies exist, loads them, and verifies login status using the ReportCollector.
    @mcp.tool()
    async def check_login_status() -> str:
        """
        检查当前登录状态(建议第一步调用)
    
        ✅ 推荐工作流程:
        1. 首先调用此工具检查登录状态
        2. 如果返回"未登录",则调用 browser_login 进行登录
        3. 登录成功后,调用 collect_reports 采集数据
    
        Returns:
            登录状态信息:
            - "✓ 已登录,Cookie 有效" -> 可以直接采集数据
            - "❌ Cookie 已过期" -> 需要调用 browser_login 重新登录
            - "❌ 未找到保存的 Cookie" -> 需要调用 browser_login 首次登录
        """
        collector = ReportCollector()
    
        try:
            # 尝试加载已保存的 Cookie
            if collector.cookie_manager.has_cookies():
                collector.load_saved_cookies()
    
                # 检查登录状态
                if collector.check_login_status():
                    return safe_text("✓ 已登录,Cookie 有效")
                else:
                    return safe_text("❌ Cookie 已过期,请重新登录并保存 Cookie")
            else:
                return safe_text("❌ 未找到保存的 Cookie,请先使用 save_cookies_from_browser 工具保存登录信息")
        except Exception as e:
            return safe_text(f"检查失败: {str(e)}")
  • Helper method in ReportCollector class that performs the actual login status check by sending a request to the report list URL and verifying the response.
    def check_login_status(self) -> bool:
        """
        检查是否已登录
    
        Returns:
            是否已登录
        """
        try:
            response = self.session.get(self.REPORT_LIST_URL, allow_redirects=False)
            # 如果返回 200 且不是重定向到登录页,说明已登录
            return response.status_code == 200 and 'login' not in response.url.lower()
        except Exception as e:
            print(f"检查登录状态失败: {e}")
            return False
Behavior4/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 effectively describes what the tool does (checks login status based on cookies), what it returns (three possible status messages with implications), and workflow dependencies. However, it doesn't mention potential side effects, error conditions, or performance characteristics like rate limits.

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 well-structured with clear sections (purpose, workflow recommendation, return values) and uses emojis/icons for visual clarity. While slightly verbose due to the detailed workflow explanation, every sentence adds value and the information is front-loaded with the core purpose.

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

Completeness5/5

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

Given the tool's simplicity (0 parameters, has output schema), the description provides complete context. It explains the purpose, when to use it, what it returns, and how it fits into the broader workflow with sibling tools. The output schema likely documents the return structure, so the description appropriately focuses on semantic meaning rather than technical format.

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?

The tool has 0 parameters with 100% schema description coverage, so the baseline is 4. The description appropriately doesn't discuss parameters since none exist, focusing instead on the tool's purpose and output.

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's purpose as '检查当前登录状态' (check current login status) with a specific verb and resource. It distinguishes from siblings like browser_login (for logging in) and collect_reports (for data collection), establishing its role as a status verification tool.

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

Usage Guidelines5/5

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

The description provides explicit usage guidelines: it recommends calling this tool first in workflows, specifies when to use alternatives (browser_login if not logged in, collect_reports if logged in), and outlines a complete three-step process. This clearly defines when and how to use it versus sibling tools.

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