Skip to main content
Glama
funinii

TrendRadar

by funinii

get_current_config

Retrieve current system configuration settings for TrendRadar's crawler, push notifications, keywords, or weight parameters to monitor and adjust data collection and analysis operations.

Instructions

获取当前系统配置

Args: section: 配置节,可选值: - "all": 所有配置(默认) - "crawler": 爬虫配置 - "push": 推送配置 - "keywords": 关键词配置 - "weights": 权重配置

Returns: JSON格式的配置信息

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sectionNoall

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The actual business logic implementation for getting current system configuration.
    def get_current_config(self, section: str = "all") -> Dict:
        """
        获取当前系统配置
    
        Args:
            section: 配置节 - all/crawler/push/keywords/weights
    
        Returns:
            配置字典
    
        Raises:
            FileParseError: 配置文件解析错误
        """
        # 尝试从缓存获取
        cache_key = f"config:{section}"
        cached = self.cache.get(cache_key, ttl=3600)  # 1小时缓存
        if cached:
            return cached
    
        # 解析配置文件
        config_data = self.parser.parse_yaml_config()
        word_groups = self.parser.parse_frequency_words()
    
        # 根据section返回对应配置
        if section == "all" or section == "crawler":
            crawler_config = {
                "enable_crawler": config_data.get("crawler", {}).get("enable_crawler", True),
                "use_proxy": config_data.get("crawler", {}).get("use_proxy", False),
                "request_interval": config_data.get("crawler", {}).get("request_interval", 1),
                "retry_times": 3,
                "platforms": [p["id"] for p in config_data.get("platforms", [])]
            }
    
        if section == "all" or section == "push":
            push_config = {
                "enable_notification": config_data.get("notification", {}).get("enable_notification", True),
                "enabled_channels": [],
                "message_batch_size": config_data.get("notification", {}).get("message_batch_size", 20),
                "push_window": config_data.get("notification", {}).get("push_window", {})
            }
    
            # 检测已配置的通知渠道
            webhooks = config_data.get("notification", {}).get("webhooks", {})
            if webhooks.get("feishu_url"):
                push_config["enabled_channels"].append("feishu")
            if webhooks.get("dingtalk_url"):
                push_config["enabled_channels"].append("dingtalk")
            if webhooks.get("wework_url"):
                push_config["enabled_channels"].append("wework")
    
        if section == "all" or section == "keywords":
            keywords_config = {
                "word_groups": word_groups,
                "total_groups": len(word_groups)
            }
    
        if section == "all" or section == "weights":
            weights_config = {
                "rank_weight": config_data.get("weight", {}).get("rank_weight", 0.6),
                "frequency_weight": config_data.get("weight", {}).get("frequency_weight", 0.3),
                "hotness_weight": config_data.get("weight", {}).get("hotness_weight", 0.1)
            }
    
        # 组装结果
        if section == "all":
            result = {
                "crawler": crawler_config,
                "push": push_config,
                "keywords": keywords_config,
                "weights": weights_config
            }
        elif section == "crawler":
            result = crawler_config
        elif section == "push":
            result = push_config
        elif section == "keywords":
            result = keywords_config
        elif section == "weights":
            result = weights_config
        else:
            result = {}
    
        # 缓存结果
        self.cache.set(cache_key, result)
    
        return result
  • The tool wrapper implementation that calls DataService and handles exceptions/responses.
    def get_current_config(self, section: Optional[str] = None) -> Dict:
        """
        获取当前系统配置
    
        Args:
            section: 配置节 - all/crawler/push/keywords/weights,默认all
    
        Returns:
            配置字典
    
        Example:
            >>> tools = ConfigManagementTools()
            >>> result = tools.get_current_config(section="crawler")
            >>> print(result['crawler']['platforms'])
        """
        try:
            # 参数验证
            section = validate_config_section(section)
    
            # 获取配置
            config = self.data_service.get_current_config(section=section)
    
            return {
                "config": config,
                "section": section,
                "success": True
            }
    
        except MCPError as e:
            return {
                "success": False,
                "error": e.to_dict()
            }
Behavior3/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 states the tool returns JSON-formatted configuration information, which is helpful. However, it doesn't mention whether this is a read-only operation (implied but not explicit), potential rate limits, authentication requirements, or error conditions. The description adds some value but leaves significant behavioral aspects unspecified.

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 for purpose, arguments, and returns. It's appropriately sized with no wasted sentences. The only minor improvement would be integrating the parameter explanation more seamlessly rather than as a separate 'Args' block, but overall it's efficient and front-loaded.

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?

Given the tool's low complexity (1 optional parameter) and the presence of an output schema (which handles return value documentation), the description is reasonably complete. It covers the core purpose and parameter semantics well. The main gap is lack of behavioral context around permissions, rate limits, or error handling, but for a simple configuration retrieval tool, this is acceptable.

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?

The description provides excellent parameter semantics despite 0% schema description coverage. It clearly explains the 'section' parameter with specific enum values ('all', 'crawler', 'push', 'keywords', 'weights'), their meanings, and the default value. This fully compensates for the lack of schema documentation and adds meaningful context beyond what a bare schema would provide.

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 tool's purpose as '获取当前系统配置' (get current system configuration), which is a specific verb+resource combination. However, it doesn't differentiate from sibling tools like 'get_system_status' or explain how configuration retrieval differs from status checking, keeping it from a perfect score.

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. There's no mention of prerequisites, timing considerations, or comparison with sibling tools like 'get_system_status' that might overlap in functionality. The agent must infer usage context independently.

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/funinii/TrendRadar'

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