Skip to main content
Glama

get_news_since_last_update

Retrieve Arch Linux news articles published after your last system update by parsing pacman.log timestamps.

Instructions

[DISCOVERY] Get news posted since last pacman update. Parses /var/log/pacman.log for last update timestamp. Only works on Arch Linux.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Main handler function that parses pacman.log for last update time, fetches recent Arch news, and filters news published after the last update.
    async def get_news_since_last_update() -> Dict[str, Any]: """ Get news posted since last pacman update. Parses /var/log/pacman.log for last update timestamp. Returns: Dict with news items posted after last update """ if not IS_ARCH: return create_error_response( "NotSupported", "This feature is only available on Arch Linux" ) logger.info("Getting news since last pacman update") try: # Parse pacman log for last update timestamp pacman_log = Path("/var/log/pacman.log") if not pacman_log.exists(): return create_error_response( "NotFound", "Pacman log file not found at /var/log/pacman.log" ) # Find last system update timestamp last_update = None with open(pacman_log, 'r') as f: for line in f: # Look for upgrade entries if " upgraded " in line or " installed " in line or "starting full system upgrade" in line: # Extract timestamp [YYYY-MM-DD HH:MM] match = re.match(r'\[(\d{4}-\d{2}-\d{2})\s+(\d{2}:\d{2})\]', line) if match: date_str = f"{match.group(1)}T{match.group(2)}:00+00:00" try: last_update = datetime.fromisoformat(date_str) except ValueError: continue if last_update is None: logger.warning("Could not determine last update timestamp") return create_error_response( "NotFound", "Could not determine last system update timestamp from pacman log" ) logger.info(f"Last update: {last_update.isoformat()}") # Fetch recent news result = await get_latest_news(limit=30) if "error" in result: return result news_items = result.get("news", []) news_since_update = [] for item in news_items: published_str = item.get("published", "") if not published_str: continue try: published = datetime.fromisoformat(published_str.replace('Z', '+00:00')) if published > last_update: news_since_update.append(item) except ValueError as e: logger.warning(f"Failed to parse date: {e}") continue logger.info(f"Found {len(news_since_update)} news items since last update") return { "last_update": last_update.isoformat(), "news_count": len(news_since_update), "has_news": len(news_since_update) > 0, "news": news_since_update } except Exception as e: logger.error(f"Failed to get news since update: {e}") return create_error_response( "NewsError", f"Failed to get news since last update: {str(e)}" )
  • MCP tool schema definition in list_tools(), defining the tool name, description, and empty input schema (no parameters).
    name="get_news_since_last_update", description="[DISCOVERY] Get news posted since last pacman update. Parses /var/log/pacman.log for last update timestamp. Only works on Arch Linux.", inputSchema={ "type": "object", "properties": {} } ),
  • Tool dispatch/registration in call_tool() handler, checks IS_ARCH and calls the get_news_since_last_update function.
    elif name == "get_news_since_last_update": if not IS_ARCH: return [TextContent(type="text", text="Error: get_news_since_last_update only available on Arch Linux systems")] result = await get_news_since_last_update() return [TextContent(type="text", text=json.dumps(result, indent=2))]
  • Import of the handler function from news.py into the main package init.
    get_latest_news, check_critical_news, get_news_since_last_update )
  • Tool metadata definition including category, platform, permissions, and related tools.
    "get_news_since_last_update": ToolMetadata( name="get_news_since_last_update", category="discovery", platform="arch", permission="read", workflow="safety", related_tools=["get_latest_news", "check_critical_news"], prerequisite_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/nihalxkumar/arch-mcp'

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