Skip to main content
Glama
modelcontextprotocol

Filesystem MCP Server

Official

List Allowed Directories

list_allowed_directories
Read-only

Display all directories the server can access, including subdirectories, to identify available paths for file operations.

Instructions

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.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
contentYes

Implementation Reference

  • Registers the 'list_allowed_directories' tool via server.registerTool() with its name, metadata (inputSchema, outputSchema, annotations), and handler.
    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 that lists allowed directories: reads from the `allowedDirectories` array and returns them as formatted text.
    async () => {
      const text = `Allowed directories:\n${allowedDirectories.join('\n')}`;
      return {
        content: [{ type: "text" as const, text }],
        structuredContent: { content: text }
      };
    }
  • Input/output schema and metadata for list_allowed_directories: empty inputSchema, outputSchema specifying content as string, and readOnlyHint annotation.
    {
      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 }
  • The `allowedDirectories` variable (module-level array) and the `getAllowedDirectories()` export that returns a copy of it.
    let allowedDirectories: string[] = [];
    
    // Function to set allowed directories from the main module
    export function setAllowedDirectories(directories: string[]): void {
      allowedDirectories = [...directories];
    }
    
    // Function to get current allowed directories
    export function getAllowedDirectories(): string[] {
      return [...allowedDirectories];
    }
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already mark the tool as read-only (readOnlyHint: true). The description adds that subdirectories within allowed directories are also accessible, which is a behavioral trait beyond the annotation. There is no contradiction, and this extra context helps the agent understand the scope of accessibility.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is two sentences long, with the first sentence stating the primary purpose and the second providing usage context. Every word serves a purpose, and it is front-loaded with the key action. No unnecessary details.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's simplicity (zero parameters, output schema exists), the description covers what the tool returns and how to use it. The mention of subdirectories and nested paths adds completeness without being verbose. The output schema handles return value details, so no further elaboration is needed.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool has zero parameters, so per the scoring rules, the baseline is 4. The description does not need to add parameter meaning since there are none. This score reflects that no additional information is required.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Returns the list of directories that this server is allowed to access.' It uses a specific verb ('returns') and resource ('list of directories'), and the mention of subdirectories adds precision. This distinguishes it from sibling tools like list_directory or directory_tree.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description explicitly advises using this tool 'before trying to access files' to understand available directories and nested paths. This provides clear context for when to use it, though it does not mention when not to use it or list alternative tools. Given the simplicity, the guidance is adequate.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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