get_filesystem_info
Retrieve metadata for files or directories in a Vertex AI workspace, including size, type, timestamps, and permissions, without accessing file content.
Instructions
Retrieve detailed metadata about a file or directory within the workspace filesystem. Returns comprehensive information including size (bytes), creation time, last modified time, last accessed time, type (file/directory), and permissions (octal string). This tool is perfect for understanding file characteristics without reading the actual content.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | The path of the file or directory to get info for (relative to the workspace directory). |
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"path": {
"description": "The path of the file or directory to get info for (relative to the workspace directory).",
"type": "string"
}
},
"required": [
"path"
],
"type": "object"
}
Implementation Reference
- src/index.ts:502-507 (handler)Main handler case for 'get_filesystem_info' tool: parses arguments, validates path, calls getFileStats helper, formats and sets resultText.case "get_filesystem_info": { const parsed = GetFileInfoArgsSchema.parse(args); const validPath = validateWorkspacePath(parsed.path); const info = await getFileStats(validPath); resultText = `Path: ${parsed.path}\nType: ${info.isDirectory ? 'Directory' : 'File'}\nSize: ${info.size} bytes\nCreated: ${info.created.toISOString()}\nModified: ${info.modified.toISOString()}\nAccessed: ${info.accessed.toISOString()}\nPermissions: ${info.permissions}`; break;
- src/index.ts:73-84 (helper)Helper function that retrieves comprehensive file/directory stats including size, timestamps, type, and permissions.async function getFileStats(filePath: string): Promise<FileInfo> { const stats = await fs.stat(filePath); return { size: stats.size, created: stats.birthtime, modified: stats.mtime, accessed: stats.atime, isDirectory: stats.isDirectory(), isFile: stats.isFile(), permissions: stats.mode.toString(8).slice(-3), // POSIX permissions }; }
- src/tools/get_file_info.ts:7-9 (schema)Zod schema defining the input parameters for the tool (path string).export const GetFileInfoArgsSchema = z.object({ path: z.string().describe("The path of the file or directory to get info for (relative to the workspace directory)."), });
- src/tools/index.ts:17-17 (registration)Import of the getFileInfoTool definition for inclusion in allTools and toolMap.import { getFileInfoTool } from "./get_file_info.js";
- src/tools/index.ts:56-57 (registration)Addition of getFileInfoTool to the allTools array, enabling listing and lookup via toolMap.searchFilesTool, getFileInfoTool,