Skip to Content

fs_stat

Facts about one file or folder without reading it: kind, size, change and creation time, permission bits, whether it is writable, a symlink’s target; with hash=true also its SHA-256, for a later fs_write or fs_edit with expect_sha256. Paths holding keys and credentials are refused.

Arguments

Over MCP every tool also takes machine: the machine’s name or id, optional when only one machine is online.

NameTypeRequiredMeaning
hashbooleannoAlso return the file’s SHA-256 (files up to 64 MiB). Pass it as expect_sha256 to fs_write or fs_edit to refuse a write when the file changed in between. Default: false.
pathstringyesFile or folder on the machine. Absolute, or relative to the user’s home folder.

Result

NameTypeRequiredMeaning
createdintegernoUnix seconds, where the file system keeps it.
kind`“file”“dir”“symlink”
link_targetstringnoWhen path itself is a symlink: where it points.
modestringnoPermission bits in octal, for example 644.
modifiedintegernoUnix seconds.
pathstringyesResolved absolute path (symlinks followed).
sha256stringnoLower-case hex, when hash was asked and the path is a file of at most 64 MiB.
sizeintegeryesBytes; 0 for folders.
writablebooleanyesWhether the user the machine program runs as may write it.

Examples

{ "name": "fs_stat", "arguments": { "machine": "<machine>", "path": "<path>" } }

Limits

The call times out after 30 s (timed_out). Available since version 0.0.1. A refused or failed call returns one of the error codes.