Skip to main content
Glama

Filesystem MCP Server

Official

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

NameRequiredDescriptionDefault

No arguments

Input Schema (JSON Schema)

{ "properties": {}, "required": [], "type": "object" }

Implementation Reference

  • 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 } }; } );
  • 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 } }; }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/modelcontextprotocol/filesystem'

If you have feedback or need assistance with the MCP directory API, please join our Discord server