Skip to main content
Glama
the0807

geeknews-mcp-server

get_articles

Fetch articles from GeekNews by specifying article type (top, new, ask, show) and quantity limit to retrieve relevant content.

Instructions

        GeekNews에서 아티클을 가져오는 도구
        
        Args:
            type: 아티클 유형 (top, new, ask, show)
            limit: 반환할 아티클 수 (최대 30)
        
        Returns:
            List[Dict[str, Any]]: 아티클 목록
            
        Raises:
            ValueError: 유효하지 않은 아티클 유형이 지정된 경우
        

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
typeNotop
limitNo

Implementation Reference

  • src/server.py:66-86 (registration)
    Registers the 'get_articles' tool using the @self.mcp.tool() decorator. Includes the schema definition in the docstring and function signature.
    def _setup_get_articles_tool(self) -> None:
        """
        get_articles 도구를 설정합니다.
        """
        @self.mcp.tool()
        def get_articles(type: str = "top", limit: int = DEFAULT_ARTICLE_LIMIT) -> List[Dict[str, Any]]:
            """
            GeekNews에서 아티클을 가져오는 도구
            
            Args:
                type: 아티클 유형 (top, new, ask, show)
                limit: 반환할 아티클 수 (최대 30)
            
            Returns:
                List[Dict[str, Any]]: 아티클 목록
                
            Raises:
                ValueError: 유효하지 않은 아티클 유형이 지정된 경우
            """
            return self._get_articles(type, limit)
  • Core handler logic for fetching articles: validates input, checks cache, refreshes via scheduler if needed, and limits results.
    def _get_articles(self, type: str, limit: int) -> List[Dict[str, Any]]:
        """
        GeekNews에서 아티클을 가져옵니다.
        
        Args:
            type: 아티클 유형 (top, new, ask, show)
            limit: 반환할 아티클 수 (최대 30)
        
        Returns:
            List[Dict[str, Any]]: 아티클 목록
        """
        # 입력 유효성 검사
        if type not in VALID_ARTICLE_TYPES:
            raise ValueError(
                f"유효하지 않은 아티클 유형: {type}. "
                f"다음 중 하나여야 합니다: {', '.join(VALID_ARTICLE_TYPES)}"
            )
        
        # 아티클 수 제한
        limit = max(1, min(limit, MAX_ARTICLES))
        
        try:
            # 캐시에서 데이터 로드 시도
            is_valid, cached_data = self.cache_manager.get_articles_cache(type)
            
            if is_valid and cached_data:
                logger.info(f"{type} 아티클 캐시 사용")
                return cached_data[:limit]
            
            # 캐시가 없거나 유효하지 않은 경우 데이터 갱신
            logger.info(f"{type} 아티클 데이터 갱신")
            articles = self.scheduler.refresh_articles(type)
            return articles[:limit]
        except Exception as e:
            logger.error(f"아티클 가져오기 실패: {e}", exc_info=True)
            return []
  • Helper function to load cached articles for a given type, returning validity and data.
    def get_articles_cache(self, article_type: str) -> Tuple[bool, List[Dict[str, Any]]]:
        """
        아티클 캐시를 로드합니다.
        
        Args:
            article_type: 아티클 유형 (top, new, ask, show)
            
        Returns:
            Tuple[bool, List[Dict[str, Any]]]: (캐시 유효 여부, 아티클 목록)
        """
        cache_key = f"articles_{article_type}"
        return self.load_cache(cache_key)
  • Helper function that refreshes articles by fetching HTML, parsing, converting to dicts, and saving to cache.
    def refresh_articles(self, article_type: str) -> List[Dict[str, Any]]:
        """
        특정 유형의 아티클 데이터를 갱신합니다.
        
        Args:
            article_type: 아티클 유형 (top, new, ask, show)
            
        Returns:
            List[Dict[str, Any]]: 갱신된 아티클 목록
        """
        try:
            # HTML 가져오기
            html = self.client.fetch_articles(article_type)
            
            # 아티클 파싱
            articles = self.parser.parse_articles(html)
            
            # 아티클 딕셔너리 변환
            article_dicts = [article.to_dict() for article in articles]
            
            # 캐시 저장
            self.cache_manager.save_articles_cache(article_type, article_dicts)
            
            logger.info(f"{article_type} 아티클 캐시 갱신 완료 ({len(article_dicts)}개)")
            return article_dicts
        except Exception as e:
            logger.error(f"{article_type} 아티클 갱신 실패: {e}", exc_info=True)
            return []
  • Docstring defining the input schema (type, limit) and output for the MCP tool.
    """
    GeekNews에서 아티클을 가져오는 도구
    
    Args:
        type: 아티클 유형 (top, new, ask, show)
        limit: 반환할 아티클 수 (최대 30)
    
    Returns:
        List[Dict[str, Any]]: 아티클 목록
        
    Raises:
        ValueError: 유효하지 않은 아티클 유형이 지정된 경우
    """
Behavior3/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 mentions the return type (List[Dict[str, Any]]) and raises a ValueError for invalid types, adding some context. However, it doesn't cover important aspects like rate limits, authentication needs, or whether it's read-only/destructive, leaving gaps for a tool with parameters.

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 sections for Args, Returns, and Raises, making it easy to scan. It's appropriately sized with no redundant sentences. However, the initial purpose statement could be more front-loaded for immediate clarity, though it's still efficient.

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

Completeness3/5

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

Given the tool has 2 parameters, no annotations, and no output schema, the description is moderately complete. It covers parameters and return values adequately but lacks behavioral details like error handling beyond ValueError, performance constraints, or sibling tool differentiation. It's sufficient for basic use but has clear gaps for full contextual understanding.

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 adds significant meaning beyond the input schema, which has 0% description coverage. It explains that 'type' is the article type with valid values (top, new, ask, show) and 'limit' is the number of articles to return with a maximum of 30. This fully compensates for the schema's lack of descriptions, providing clear semantics for both parameters.

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: 'GeekNews에서 아티클을 가져오는 도구' (Get articles from GeekNews). It specifies the verb '가져오는' (get/fetch) and resource '아티클' (articles), making the action explicit. However, it doesn't distinguish from the sibling tool 'get_weekly_news', which likely serves a different purpose but isn't contrasted here.

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. It mentions parameters and returns but doesn't explain context, prerequisites, or comparisons to 'get_weekly_news'. Usage is implied through parameter details but lacks explicit when/when-not instructions.

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/the0807/GeekNews-MCP-Server'

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