Storage Tools¶
storage ¶
Storage and hardware tools.
attr_sorter ¶
Sort based on the given attribute in a case-insensitive manner
Source code in src/linux_mcp_server/tools/storage.py
list_block_devices
async
¶
List block devices.
Retrieves all block devices (disks, partitions, LVM volumes) with their name, size, type, mount point, and filesystem information.
Source code in src/linux_mcp_server/tools/storage.py
list_directories
async
¶
list_directories(
path: Annotated[
Path,
BeforeValidator(validate_path),
Field(
description="Absolute path to the directory to analyze",
examples=[
"/var/log",
"/etc",
"/home",
"/opt",
"/tmp",
],
),
],
order_by: Annotated[
OrderBy,
"Sort order - 'size', 'name', or 'modified' (default: 'name')",
] = OrderBy.NAME,
sort: Annotated[
SortBy,
"Sort direction - 'ascending' or 'descending' (default: 'ascending')",
] = SortBy.ASCENDING,
top_n: Annotated[
int | None,
Field(
description="Optional limit on number of directories to return (1-1000)",
gt=0,
le=1000,
),
] = None,
host: Host = None,
) -> StorageNodes
List directories under a specified path.
Retrieves subdirectories with their size (when ordered by size) or modification time, supporting flexible sorting and result limiting.
Source code in src/linux_mcp_server/tools/storage.py
list_files
async
¶
list_files(
path: Annotated[
Path,
BeforeValidator(validate_path),
Field(
description="Absolute path to the directory to analyze",
examples=[
"/var/log",
"/etc",
"/home",
"/opt",
"/tmp",
],
),
],
order_by: Annotated[
OrderBy,
"Sort order - 'size', 'name', or 'modified' (default: 'name')",
] = OrderBy.NAME,
sort: Annotated[
SortBy,
"Sort direction - 'ascending' or 'descending' (default: 'ascending')",
] = SortBy.ASCENDING,
top_n: Annotated[
int | None,
Field(
description="Optional limit on number of files to return (1-1000, only used with size ordering)",
gt=0,
le=1000,
),
] = None,
host: Host = None,
) -> StorageNodes
List files under a specified path.
Retrieves files with their size or modification time, supporting flexible sorting and result limiting. Useful for finding large or recently modified files.
Source code in src/linux_mcp_server/tools/storage.py
read_file
async
¶
read_file(
path: Annotated[
Path,
BeforeValidator(validate_path),
Field(
description="Absolute path to the file to read",
examples=[
"/etc/hosts",
"/etc/resolv.conf",
"/etc/os-release",
"/proc/cpuinfo",
],
),
],
host: Host = None,
) -> str
Read the contents of a file.
Retrieves the full contents of a text file. The path must be absolute and the file must exist. Binary files may not display correctly.