list_allowed_directories
Retrieve the list of directories accessible by the server, enabling controlled file system operations and terminal command execution with Claude Desktop Commander MCP.
Instructions
Returns the list of directories that this server is allowed to access.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/filesystem.ts:152-154 (handler)The core handler function that returns the predefined list of allowed directories.export function listAllowedDirectories(): string[] { return allowedDirectories; }
- src/server.ts:188-197 (registration)Tool registration in the ListTools response, including name, description, and empty input schema.{ name: "list_allowed_directories", description: "Returns the list of directories that this server is allowed to access.", inputSchema: { type: "object", properties: {}, required: [], }, },
- src/server.ts:327-335 (handler)The dispatch handler in the CallToolRequest switch statement that invokes the core function and formats the response.case "list_allowed_directories": { const directories = listAllowedDirectories(); return { content: [{ type: "text", text: `Allowed directories:\n${directories.join('\n')}` }], }; }
- src/tools/filesystem.ts:5-9 (helper)The constant array defining the allowed directories used by the handler.// Store allowed directories const allowedDirectories: string[] = [ process.cwd(), // Current working directory os.homedir() // User's home directory ];