Skip to main content
Glama

Get File Info

stat
Read-onlyIdempotent

Retrieve metadata for files or directories to check existence, size, and read cost. One path returns a single result; up to 1000 paths return per-path values in input order.

Instructions

Get metadata for files or directories. Use when you need to check existence, size, or read cost. Do not use for contents; use read instead, list for directory entries, or find_files to find by name. Pass path or paths (up to 1000). Paths settle independently (missing gives NOT_FOUND); the call errors only if all fail. Symlinks report their own metadata, not the target's. path gives one result; paths gives one per path, in input order. Returns per-path values or errors ({ code, message }), plus summary { total, succeeded, failed }. Values hold name, path, type, size or entryCount (directories), tokenEstimate (files, bytes/4), lineCount (text files up to 256 KiB, in calls of up to 20 paths), timestamps, permissions (POSIX) or readOnly (Windows), isHidden (dot prefix), hardLinks (a file with other names; a write changes them all), mimeType, symlinkTarget.

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "stat"
  }
}

Input Schema

NameRequiredDescriptionDefault
pathNoSingle file path; mutually exclusive with paths
pathsNoArray of file paths for batch mode (max 1000); mutually exclusive with path

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv2.22.0
    • changedInput schema / properties / paths / items / description
      Previous value: -"File or directory path inside an allowed workspace root."New value: +"File or directory path inside a root, absolute or relative to it."
  2. Changed1 schema field changedv2.9.1
    • removedInput schema / oneOf
      Removed value: -[
      -  {
      -    "required": [
      -      "path"
      -    ]
      -  },
      -  {
      -    "required": [
      -      "paths"
      -    ]
      -  }
      -]
  3. Changed1 schema field changedv2.4.1
    • addedInput schema / $schema
      Added value: +"https://json-schema.org/draft/2020-12/schema"
  4. Changed6 schema fields changedv2.0.0
    • removedInput schema / $schema
      Removed value: -"https://json-schema.org/draft/2020-12/schema"
    • addedInput schema / oneOf
      Added value: +[
      +  {
      +    "required": [
      +      "path"
      +    ]
      +  },
      +  {
      +    "required": [
      +      "paths"
      +    ]
      +  }
      +]
    • changedInput schema / properties / path / description
      Previous value: -"Absolute path to file or directory."New value: +"Single file path; mutually exclusive with paths"
    • addedInput schema / properties / paths
      Added value: +{
      +  "description": "Array of file paths for batch mode (max 1000); mutually exclusive with path",
      +  "items": {
      +    "description": "File or directory path inside an allowed workspace root.",
      +    "maxLength": 4096,
      +    "minLength": 1,
      +    "type": "string"
      +  },
      +  "maxItems": 1000,
      +  "minItems": 1,
      +  "type": "array"
      +}
    • removedInput schema / required
      Removed value: -[
      -  "path"
      -]
    • changedOutput schema / (root)
      Previous value: -{
      -  "$schema": "https://json-schema.org/draft/2020-12/schema",
      -  "additionalProperties": false,
      -  "properties": {
      -    "info": {
      -      "additionalProperties": false,
      -      "properties": {
      -        "accessed": {
      -          "description": "Accessed",
      -          "format": "date-time",
      -          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
      -          "type": "string"
      -        },
      -        "created": {
      -          "description": "Created",
      -          "format": "date-time",
      -          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
      -          "type": "string"
      -        },
      -        "isHidden": {
      -          "description": "Hidden?",
      -          "type": "boolean"
      -        },
      -        "mimeType": {
      -          "description": "MIME type",
      -          "type": "string"
      -        },
      -        "modified": {
      -          "description": "Modified",
      -          "format": "date-time",
      -          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
      -          "type": "string"
      -        },
      -        "name": {
      -          "description": "Name",
      -          "type": "string"
      -        },
      -        "path": {
      -          "description": "Absolute path",
      -          "type": "string"
      -        },
      -        "permissions": {
      -          "description": "Permissions",
      -          "type": "string"
      -        },
      -        "size": {
      -          "description": "Size (bytes)",
      -          "maximum": 9007199254740991,
      -          "minimum": 0,
      -          "type": "integer"
      -        },
      -        "symlinkTarget": {
      -          "description": "Target (symlink)",
      -          "type": "string"
      -        },
      -        "tokenEstimate": {
      -          "description": "Est. tokens (size/4)",
      -          "maximum": 9007199254740991,
      -          "minimum": 0,
      -          "type": "integer"
      -        },
      -        "type": {
      -          "description": "Type",
      -          "enum": [
      -            "file",
      -            "directory",
      -            "symlink",
      -            "other"
      -          ],
      -          "type": "string"
      -        }
      -      },
      -      "required": [
      -        "name",
      -        "path",
      -        "type",
      -        "size",
      -        "created",
      -        "modified",
      -        "accessed",
      -        "permissions",
      -        "isHidden"
      -      ],
      -      "type": "object"
      -    },
      -    "ok": {
      -      "const": true,
      -      "type": "boolean"
      -    }
      -  },
      -  "required": [
      -    "ok"
      -  ],
      -  "type": "object"
      -}New value: +null
  5. Addedv1.15.3
  6. Removedv1.15.0
  7. First observed

TDQS

A4.6/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already declare readOnly, idempotent, non-destructive, closed-world, so the safety profile is covered. The description adds substantial behavior beyond that: partial-failure semantics (paths settle independently, NOT_FOUND for missing, call errors only if all fail), symlink handling (own metadata, not target's), and hardLinks warning that a write changes all names. It does not discuss auth or permission failures, but the partial-failure model is well disclosed.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loaded with purpose, then routing, then parameter rules, then return semantics — a sensible order. It is dense but nearly every clause carries facts (byte-to-token ratio, 256 KiB line-count limit, batch size for line counting); the only cost is a long final paragraph mixing output fields with caveats, mildly harder to scan than the opening.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

There is no output schema, so the description must explain return values — it does, listing per-path value fields, the error shape { code, message }, and the summary { total, succeeded, failed }. Combined with the partial-failure and symlink rules, an agent has everything needed to call it and interpret results.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the baseline is 3, but the description adds meaning the schema lacks: `path` yields exactly one result while `paths` yields one per input path in input order, and the 1000 cap is restated in context. The ordering guarantee is genuinely new information an agent needs to map results back to inputs.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource ('Get metadata for files or directories') and immediately scopes it against the siblings it is not (read, list, find_files). An agent can distinguish it from every neighbor without opening a schema.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Gives explicit when-to-use triggers ('check existence, size, or read cost') and explicit when-not with named alternatives for each case: `read` for contents, `list` for directory entries, `find_files` for lookup by name. It also states the selection rule between the two parameters.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.