Skip to main content
Glama
sureshsankaran

Obsidian Tools MCP Server

list_folder

List all notes and subfolders within a specified folder in your Obsidian vault. Use this tool to organize and navigate your vault structure by viewing contents at any directory level.

Instructions

List all notes and subfolders in a folder

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathNoFolder path relative to vault root. Use empty string for vault root
recursiveNoWhether to list recursively. Default: false

Implementation Reference

  • The handler function that implements the core logic for the 'list_folder' tool. It reads the directory at the given path, lists .md notes and subfolders, and recursively lists subfolders if specified, returning a JSON object with notes and folders arrays.
    async function handleListFolder(args: {
      path?: string;
      recursive?: boolean;
    }): Promise<string> {
      const folderPath = path.join(VAULT_PATH, args.path || "");
      const recursive = args.recursive ?? false;
    
      if (!(await fileExists(folderPath))) {
        throw new Error(`Folder not found at ${args.path}`);
      }
    
      const entries = await fs.readdir(folderPath, { withFileTypes: true });
      const result: { notes: string[]; folders: string[] } = {
        notes: [],
        folders: [],
      };
    
      for (const entry of entries) {
        if (entry.name.startsWith(".")) continue;
    
        if (entry.isDirectory()) {
          result.folders.push(entry.name);
          if (recursive) {
            const subResult = await handleListFolder({
              path: path.join(args.path || "", entry.name),
              recursive: true,
            });
            const parsed = JSON.parse(subResult);
            result.notes.push(
              ...parsed.notes.map((n: string) => path.join(entry.name, n))
            );
          }
        } else if (entry.isFile() && entry.name.endsWith(".md")) {
          result.notes.push(entry.name);
        }
      }
    
      return JSON.stringify(result, null, 2);
    }
  • src/index.ts:208-227 (registration)
    The tool definition object in the 'tools' array used for registration. Includes the name, description, and input schema, returned by ListToolsRequest.
      name: "list_folder",
      description: "List all notes and subfolders in a folder",
      inputSchema: {
        type: "object",
        properties: {
          path: {
            type: "string",
            description:
              "Folder path relative to vault root. Use empty string for vault root",
            default: "",
          },
          recursive: {
            type: "boolean",
            description: "Whether to list recursively. Default: false",
            default: false,
          },
        },
        required: [],
      },
    },
  • src/index.ts:906-910 (registration)
    The switch case in the main CallToolRequest handler that dispatches calls to the 'list_folder' tool to its handler function.
    case "list_folder":
      result = await handleListFolder(
        args as { path?: string; recursive?: boolean }
      );
      break;
  • The input schema defining the parameters for the 'list_folder' tool: optional path (string) and recursive (boolean).
      type: "object",
      properties: {
        path: {
          type: "string",
          description:
            "Folder path relative to vault root. Use empty string for vault root",
          default: "",
        },
        recursive: {
          type: "boolean",
          description: "Whether to list recursively. Default: false",
          default: false,
        },
      },
      required: [],
    },
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions listing items but does not cover critical aspects like whether this is a read-only operation, potential rate limits, authentication needs, or what the output format looks like (e.g., list structure, pagination). This leaves significant gaps for an agent to understand the tool's behavior.

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 a single, direct sentence that efficiently conveys the core functionality without any wasted words. It is front-loaded and appropriately sized for a simple listing tool.

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

Completeness3/5

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

Given the tool's low complexity (a read operation with two well-documented parameters) and no output schema, the description is minimally adequate but incomplete. It lacks details on behavioral traits (e.g., safety, output format) that would help an agent use it correctly, especially since no annotations are present to fill those gaps.

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

Parameters3/5

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

The input schema has 100% description coverage, clearly documenting both parameters ('path' and 'recursive') with their types, defaults, and purposes. The description adds no additional parameter semantics beyond what the schema provides, so it meets the baseline for high schema coverage without compensating value.

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

Purpose4/5

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

The description clearly states the verb ('List') and resource ('all notes and subfolders in a folder'), making the purpose immediately understandable. However, it does not explicitly distinguish this tool from sibling tools like 'search_notes' or 'search_content', which might offer similar listing capabilities with filtering, so it misses full sibling differentiation.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives such as 'search_notes' or 'search_content', nor does it mention any prerequisites or exclusions. It simply states what the tool does without contextual usage advice.

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/sureshsankaran/obsidian-tools-mcp'

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