openwrt_opkg_info
Retrieve detailed information about OpenWRT packages to verify availability, dependencies, and installation status for remote router management.
Instructions
Get detailed information about a specific package
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| package_name | Yes | Name of the package |
Implementation Reference
- openwrt_ssh_mcp/tools.py:661-699 (handler)The actual implementation of opkg_info that validates package name format, executes 'opkg info {package_name}' command, parses the output into a dictionary, and returns the package information@staticmethod async def opkg_info(package_name: str) -> dict[str, Any]: """ Get information about a package. Args: package_name: Name of the package Returns: dict: Package information """ # Validate package name if not re.match(r'^[a-zA-Z0-9._-]+$', package_name): return { "success": False, "error": "Invalid package name. Use only alphanumeric characters, dash, underscore, and dot.", } command = f"opkg info {package_name}" result = await OpenWRTTools.execute_command(command) if result["success"]: # Parse package info info = {} for line in result["output"].strip().split("\n"): if ": " in line: key, value = line.split(": ", 1) info[key.lower().replace(" ", "_")] = value return { "success": True, "package_info": info, } else: return { "success": False, "error": result["error"], "output": result["output"], }
- openwrt_ssh_mcp/server.py:262-275 (schema)Tool registration with schema definition including the tool name, description, and inputSchema defining package_name as a required string parameterTool( name="openwrt_opkg_info", description="Get detailed information about a specific package", inputSchema={ "type": "object", "properties": { "package_name": { "type": "string", "description": "Name of the package", }, }, "required": ["package_name"], }, ),
- openwrt_ssh_mcp/server.py:367-371 (registration)Handler routing logic that extracts package_name from arguments, validates it's present, and delegates to OpenWRTTools.opkg_info(package_name)elif name == "openwrt_opkg_info": package_name = arguments.get("package_name") if not package_name: raise ValueError("Missing required argument: package_name") result = await OpenWRTTools.opkg_info(package_name)