Skip to main content
Glama
the0807

geeknews-mcp-server

get_weekly_news

Fetch weekly tech news from GeekNews by specifying a weekly ID or retrieving the most recent edition.

Instructions

GeekNews에서 주간 뉴스를 가져오는 도구 Args: weekly_id: 주간 뉴스 ID (빈 문자열인 경우 가장 최근 주간 뉴스를 가져옴) Returns: Dict[str, Any]: 주간 뉴스 정보

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
weekly_idNo

Implementation Reference

  • Core handler function implementing the get_weekly_news tool logic: checks cache validity, loads from cache if valid, otherwise refreshes via scheduler, handles errors.
    def _get_weekly_news(self, weekly_id: str = "") -> Dict[str, Any]: """ GeekNews에서 주간 뉴스를 가져옵니다. Args: weekly_id: 주간 뉴스 ID (빈 문자열인 경우 가장 최근 주간 뉴스를 가져옴) Returns: Dict[str, Any]: 주간 뉴스 정보 """ cache_id = weekly_id if weekly_id else "latest" try: # 캐시에서 데이터 로드 시도 is_valid, cached_data = self.cache_manager.get_weekly_news_cache(cache_id) if is_valid and cached_data: logger.info(f"주간 뉴스 캐시 사용 (ID: {cache_id})") return cached_data # 캐시가 없거나 유효하지 않은 경우 데이터 갱신 logger.info(f"주간 뉴스 데이터 갱신 (ID: {cache_id})") return self.scheduler.refresh_weekly_news(weekly_id) except Exception as e: logger.error(f"주간 뉴스 가져오기 실패: {e}", exc_info=True) return { "title": "GeekNews Weekly", "number": 0, "id": weekly_id if weekly_id else "", "content": "주간 뉴스를 가져오는 중 오류가 발생했습니다.", "url": f"{self.client.base_url}/weekly" + (f"/{weekly_id}" if weekly_id else ""), "items": [] }
  • src/server.py:91-102 (registration)
    Registers the get_weekly_news tool with MCP server using @mcp.tool() decorator, defines input schema via args and docstring.
    @self.mcp.tool() def get_weekly_news(weekly_id: str = "") -> Dict[str, Any]: """ GeekNews에서 주간 뉴스를 가져오는 도구 Args: weekly_id: 주간 뉴스 ID (빈 문자열인 경우 가장 최근 주간 뉴스를 가져옴) Returns: Dict[str, Any]: 주간 뉴스 정보 """ return self._get_weekly_news(weekly_id)
  • Tool function signature and docstring defining input (weekly_id: str) and output schema.
    def get_weekly_news(weekly_id: str = "") -> Dict[str, Any]: """ GeekNews에서 주간 뉴스를 가져오는 도구 Args: weekly_id: 주간 뉴스 ID (빈 문자열인 경우 가장 최근 주간 뉴스를 가져옴) Returns: Dict[str, Any]: 주간 뉴스 정보 """ return self._get_weekly_news(weekly_id)
  • Helper function to load and validate weekly news cache data.
    def get_weekly_news_cache(self, weekly_id: str = "latest") -> Tuple[bool, Dict[str, Any]]: """ 주간 뉴스 캐시를 로드합니다. Args: weekly_id: 주간 뉴스 ID (빈 문자열인 경우 "latest" 사용) Returns: Tuple[bool, Dict[str, Any]]: (캐시 유효 여부, 주간 뉴스 정보) """ cache_key = f"weekly_{weekly_id if weekly_id else 'latest'}" return self.load_cache(cache_key)
  • Dataclass defining the structure of WeeklyNews output.
    @dataclass class WeeklyNews: """ GeekNews 주간 뉴스 클래스 주간 뉴스의 제목, 번호, ID, 내용, URL 등의 정보를 저장합니다. """ title: str number: int id: str content: str url: str items: List[Dict[str, Any]] def to_dict(self) -> Dict[str, Any]: """ 주간 뉴스를 딕셔너리로 변환 Returns: Dict[str, Any]: 주간 뉴스 정보를 담은 딕셔너리 """ return asdict(self)
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