fs.list
The fs.list tool lists directory entries within the agent's capability-scoped paths. Supports optional glob filtering.
Capabilities Required
tool.invoke:fs.list
fs.read:<path-glob>
Path access for listing is checked against fs.read capabilities.
Input Schema
{
"type": "object",
"required": ["path"],
"properties": {
"path": {
"type": "string",
"description": "Absolute path to the directory to list."
},
"glob": {
"type": "string",
"description": "Optional glob pattern to filter results (e.g. '*.md')."
}
}
}
Output Schema
{
"type": "array",
"items": {
"type": "object",
"properties": {
"name": { "type": "string" },
"path": { "type": "string" },
"is_dir": { "type": "boolean" },
"size": { "type": "integer" },
"modified": { "type": "string", "description": "ISO 8601 timestamp" }
}
}
}
Examples
#![allow(unused)] fn main() { // List a directory let entries = agent.invoke_tool("fs.list", json!({ "path": "/workspace" })).await?; for entry in entries.as_array().unwrap_or(&vec![]) { println!("{}: {} bytes", entry["name"], entry["size"]); } // List with glob filter let md_files = agent.invoke_tool("fs.list", json!({ "path": "/workspace", "glob": "*.md" })).await?; }
ash tools invoke <agent-id> fs.list '{"path": "/workspace", "glob": "*.md"}'
Cost
Estimated cost: 0.1
Error Cases
| Error | Cause |
|---|---|
access denied: fs.read:/path | Path not in declared read scopes |
not a directory | Path is a file, not a directory |
not found | Directory does not exist |