Skip to main content
Glama

find_failed_transactions

Identify failed package transactions in pacman logs on Arch Linux to diagnose installation issues and resolve system errors.

Instructions

[HISTORY] Find failed package transactions in pacman log. Only works on Arch Linux.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The core implementation of the find_failed_transactions tool. Scans /var/log/pacman.log for lines containing error keywords (error, failed, warning, etc.), extracts timestamps and severity, limits to 100 most recent, and returns structured failure data.
    async def find_failed_transactions() -> Dict[str, Any]: """ Find failed package transactions in pacman log. Returns: Dict with failed transaction information """ if not IS_ARCH: return create_error_response( "NotSupported", "This feature is only available on Arch Linux" ) logger.info("Searching for failed transactions") try: pacman_log = Path(PACMAN_LOG) if not pacman_log.exists(): return create_error_response( "NotFound", f"Pacman log file not found at {PACMAN_LOG}" ) failed_transactions = [] error_keywords = ["error", "failed", "warning", "could not", "unable to", "conflict"] with open(pacman_log, 'r') as f: for line in f: line_lower = line.lower() # Check for error indicators if any(keyword in line_lower for keyword in error_keywords): # Extract timestamp if available timestamp_match = re.match(r'\[(\d{4}-\d{2}-\d{2})\s+(\d{2}:\d{2})\]', line) timestamp = "" if timestamp_match: timestamp = f"{timestamp_match.group(1)}T{timestamp_match.group(2)}:00" # Extract severity severity = "error" if "error" in line_lower or "failed" in line_lower else "warning" failed_transactions.append({ "timestamp": timestamp, "severity": severity, "message": line.strip() }) # Limit to most recent 100 failures failed_transactions = failed_transactions[-100:] logger.info(f"Found {len(failed_transactions)} failed/warning entries") return { "count": len(failed_transactions), "has_failures": len(failed_transactions) > 0, "failures": failed_transactions } except Exception as e: logger.error(f"Failed to search for failures: {e}") return create_error_response( "LogParseError", f"Failed to search for failed transactions: {str(e)}" )
  • MCP tool registration in list_tools(), defining the tool name, description, and empty input schema (no parameters required).
    Tool( name="find_failed_transactions", description="[HISTORY] Find failed package transactions in pacman log. Only works on Arch Linux.", inputSchema={ "type": "object", "properties": {} } ),
  • The call_tool dispatcher branch that executes the find_failed_transactions function and formats the response as JSON text content.
    elif name == "find_failed_transactions": if not IS_ARCH: return [TextContent(type="text", text="Error: find_failed_transactions only available on Arch Linux systems")] result = await find_failed_transactions() return [TextContent(type="text", text=json.dumps(result, indent=2))]
  • Tool metadata definition categorizing it as a 'history' tool for debugging on Arch Linux, read-only, related to transaction history.
    "find_failed_transactions": ToolMetadata( name="find_failed_transactions", category="history", platform="arch", permission="read", workflow="debug", related_tools=["get_transaction_history"], prerequisite_tools=[]
  • Import statement exposing the find_failed_transactions function from logs.py for use in the server module.
    from .logs import ( get_transaction_history, find_when_installed, find_failed_transactions,

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