list_allowed_directories
Retrieve accessible root directories on the Filesystem MCP Server to determine permitted file paths before accessing files or resources.
Instructions
Returns the list of root directories that this server is allowed to access. Use this to understand which directories are available before trying to access files.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Input Schema (JSON Schema)
{
"properties": {},
"required": [],
"type": "object"
}
Implementation Reference
- src/filesystem/index.ts:664-684 (registration)Registration of the 'list_allowed_directories' tool, including inline schema and handler function that lists the globally defined allowedDirectories.server.registerTool( "list_allowed_directories", { title: "List Allowed Directories", description: "Returns the list of directories that this server is allowed to access. " + "Subdirectories within these allowed directories are also accessible. " + "Use this to understand which directories and their nested paths are available " + "before trying to access files.", inputSchema: {}, outputSchema: { content: z.string() }, annotations: { readOnlyHint: true } }, async () => { const text = `Allowed directories:\n${allowedDirectories.join('\n')}`; return { content: [{ type: "text" as const, text }], structuredContent: { content: text } }; } );
- src/filesystem/index.ts:677-683 (handler)The handler function for 'list_allowed_directories' tool, which formats and returns the list of allowed directories as text content.async () => { const text = `Allowed directories:\n${allowedDirectories.join('\n')}`; return { content: [{ type: "text" as const, text }], structuredContent: { content: text } }; }