list_allowed_directories
Retrieve the list of directories accessible by the File Merger MCP Server. Use this to verify permitted paths before initiating file merge operations.
Instructions
Returns the list of directories that this server is allowed to access. Use this to understand which directories are available before trying to merge files.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:204-213 (handler)Handler implementation for the 'list_allowed_directories' tool. Returns a text response listing the allowed directories or a message indicating no restrictions.case "list_allowed_directories": { return { content: [{ type: "text", text: allowedDirectories.length > 0 ? `Allowed directories:\n${allowedDirectories.join('\n')}` : "No directory restrictions - all directories are allowed" }], }; }
- src/index.ts:110-120 (registration)Registration of the 'list_allowed_directories' tool in the ListToolsRequestHandler, including name, description, and empty input schema.{ name: "list_allowed_directories", description: "Returns the list of directories that this server is allowed to access. " + "Use this to understand which directories are available before trying to merge files.", inputSchema: { type: "object", properties: {}, required: [], }, },
- src/index.ts:18-40 (helper)Initialization and validation of the 'allowedDirectories' array from command-line arguments, which is used by the 'list_allowed_directories' tool.const args = process.argv.slice(2); let allowedDirectories: string[] = []; if (args.length > 0) { allowedDirectories = args.map(dir => path.resolve(dir)); // Validate directories if specified for (const dir of allowedDirectories) { try { const stats = await fs.stat(dir); if (!stats.isDirectory()) { console.error(`Error: ${dir} is not a directory`); process.exit(1); } } catch (error) { console.error(`Error accessing directory ${dir}:`, error); process.exit(1); } } } else { // Default to current directory if no arguments provided allowedDirectories = [process.cwd()]; }
- src/index.ts:115-119 (schema)Input schema for the 'list_allowed_directories' tool, which requires no parameters (empty object).inputSchema: { type: "object", properties: {}, required: [], },