list_allowed_directories
Retrieve a list of all directories accessible by the Filesystem MCP Server, enabling users to identify permitted paths for file operations.
Instructions
List all directories the server is allowed to access
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:428-437 (handler)The handler for the 'list_allowed_directories' tool. It returns a JSON string of the resolved allowed directories.case 'list_allowed_directories': { return { content: [ { type: 'text', text: JSON.stringify(resolvedAllowedDirectories, null, 2), }, ], }; }
- src/index.ts:222-230 (registration)Registration of the 'list_allowed_directories' tool in the ListTools response, including its name, description, and input schema.{ name: 'list_allowed_directories', description: 'List all directories the server is allowed to access', inputSchema: { type: 'object', properties: {}, required: [], }, },
- src/index.ts:15-23 (helper)Helper code that parses command-line arguments to set up the list of allowed directories, which is used by the tool handler.const allowedDirectories = process.argv.slice(2); if (allowedDirectories.length === 0) { console.error('Error: No allowed directories specified.'); console.error('Usage: node build/index.js /path/to/allowed/dir1 /path/to/allowed/dir2 ...'); process.exit(1); } // Resolve all allowed directories to absolute paths const resolvedAllowedDirectories = allowedDirectories.map(dir => path.resolve(dir));