Skip to main content
Glama

get_news_since_last_update

Retrieve Arch Linux news published after your last system update by parsing pacman.log to stay informed about recent changes and announcements.

Instructions

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

  • The main handler function implementing the tool logic: parses /var/log/pacman.log for the last update timestamp, fetches recent Arch news, and filters news items 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 registration in list_tools(): defines the tool name, description, and input schema (empty object).
    Tool( 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 metadata definition including category, platform requirements, permissions, workflow, 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=[] ),
  • Tool invocation in call_tool(): checks if on Arch Linux, calls the handler function, and returns JSON response.
    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 tool handler function into the package namespace for exposure to the MCP server.
    from .news import ( get_latest_news, check_critical_news, get_news_since_last_update )

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