Skip to main content
Glama
jagoff

obsidian-mcp-complete

by jagoff

obsidian_list_files

Read-only

List files and folders in a vault directory, with support for recursive search, depth limit, and extension filtering.

Instructions

List files and folders in a vault folder. Supports recursive walks, max depth, and extension filtering.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
vaultNoOptional configured vault name. Defaults to the server default vault.
folderNo.
recursiveNo
maxDepthNo
extensionNo
includeDirectoriesNo
limitNo
offsetNo

Implementation Reference

  • src/tools.ts:99-118 (registration)
    Registration of the 'obsidian_list_files' tool with its Zod schema and handler. The handler delegates to vaults.listEntries() and then paginates results.
    tool(
      "obsidian_list_files",
      "List files and folders in a vault folder. Supports recursive walks, max depth, and extension filtering.",
      {
        vault: vaultArg,
        folder: z.string().optional().default("."),
        recursive: z.boolean().optional().default(false),
        maxDepth: z.number().int().min(1).max(20).optional().default(4),
        extension: z.string().optional(),
        includeDirectories: z.boolean().optional().default(true),
        limit: z.number().int().min(1).max(5000).optional().default(1000),
        offset: z.number().int().min(0).optional().default(0),
      },
      async (args) => {
        const entries = await vaults.listEntries(args.vault, args);
        const page = entries.slice(args.offset, args.offset + args.limit);
        return { entries: page, total: entries.length, offset: args.offset, truncated: args.offset + args.limit < entries.length };
      },
      { readOnlyHint: true },
    );
  • Input schema for obsidian_list_files: vault, folder, recursive, maxDepth, extension, includeDirectories, limit, offset.
    vault: vaultArg,
    folder: z.string().optional().default("."),
    recursive: z.boolean().optional().default(false),
    maxDepth: z.number().int().min(1).max(20).optional().default(4),
    extension: z.string().optional(),
    includeDirectories: z.boolean().optional().default(true),
    limit: z.number().int().min(1).max(5000).optional().default(1000),
    offset: z.number().int().min(0).optional().default(0),
  • Handler function for obsidian_list_files: calls vaults.listEntries() then paginates the results with offset/limit.
    async (args) => {
      const entries = await vaults.listEntries(args.vault, args);
      const page = entries.slice(args.offset, args.offset + args.limit);
      return { entries: page, total: entries.length, offset: args.offset, truncated: args.offset + args.limit < entries.length };
    },
  • VaultManager.listEntries() - the core helper that performs the actual file listing using fast-glob, filtering by folder, recursion, depth, extension, and directory inclusion.
    async listEntries(
      vaultName?: string | null,
      options: { folder?: string; recursive?: boolean; maxDepth?: number; extension?: string; includeDirectories?: boolean } = {},
    ): Promise<VaultFileEntry[]> {
      const vault = this.getVault(vaultName);
      const folder = normalizeRelativePath(options.folder || ".");
      const base = this.resolvePath(folder, vault.name);
      const depth = options.recursive ? options.maxDepth ?? 20 : 1;
      const pattern = options.recursive ? "**/*" : "*";
      const entries = await fg(pattern, {
        cwd: base.absolute,
        dot: false,
        onlyFiles: false,
        markDirectories: false,
        ignore: DEFAULT_IGNORES,
        deep: depth,
        stats: true,
        followSymbolicLinks: false,
      });
      const out: VaultFileEntry[] = [];
      for (const item of entries) {
        if (typeof item === "string") continue;
        const rel = toPosix(path.join(base.relative === "." ? "" : base.relative, item.path));
        const stats = item.stats;
        if (!stats) continue;
        const isDir = stats.isDirectory();
        if (isDir && options.includeDirectories === false) continue;
        const ext = path.posix.extname(rel);
        if (options.extension && ext.toLowerCase() !== normalizeExtension(options.extension)) continue;
        out.push({
          path: rel,
          name: path.posix.basename(rel),
          type: isDir ? "directory" : "file",
          size: stats.size,
          mtime: stats.mtime.toISOString(),
          extension: ext,
        });
      }
      return out.sort((a, b) => a.path.localeCompare(b.path));
    }
  • Return type VaultFileEntry used by listEntries, defining the structure of each entry in the file listing.
    export type VaultFileEntry = {
      path: string;
      name: string;
      type: "file" | "directory";
      size: number;
      mtime: string;
      extension: string;
    };
Behavior3/5

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

Annotations already indicate read-only and non-destructive behavior. The description adds that it supports recursive walks, depth limits, and extension filtering, but fails to mention pagination (limit/offset) or the includeDirectories option. This leaves some behavioral traits undisclosed for a tool with 8 parameters.

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, front-loaded sentence with no wasted words. It efficiently conveys the core purpose and key features.

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 8 parameters and no output schema, the description is incomplete. It doesn't explain the return format, pagination, or the behavior of includeDirectories. While it covers the main features, important context for a complete understanding is missing.

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?

Schema description coverage is only 13% (only 'vault' has a description). The description adds meaning for recursive, maxDepth, and extension by mentioning them, but does not explain folder path format, limit, offset, or includeDirectories. It partially compensates but leaves gaps.

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 it lists files and folders in a vault folder, specifying key features like recursive walks, max depth, and extension filtering. This distinguishes it from other sibling tools like obsidian_list_attachments or obsidian_search paths.

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

Usage Guidelines3/5

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

Implied usage: use when you need to list files/folders. No explicit when-not-to-use or alternatives mentioned. The description lacks guidance on when to prefer this over other list-like tools.

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

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