Skip to main content
Glama
YanceyOfficial

Obsidian iCloud MCP

list_directory

Retrieve a detailed directory listing from Obsidian iCloud MCP, distinguishing files and directories with [FILE] and [DIR] prefixes. Essential for navigating and identifying specific items within your Obsidian vault.

Instructions

Your task is to list directory under /Users/username/Library/Mobile Documents/iCloud~md~obsidian/Documents/my-vault. Get a detailed listing of all files and directories in a specified path. Results clearly distinguish between files and directories with [FILE] and [DIR] prefixes. This tool is essential for understanding directory structure and finding specific files within a directory. Only works within allowed directories.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYes

Implementation Reference

  • The handler function for the list_directory tool. It validates input using ListDirectoryArgsSchema, reads directory contents with fs.readdir, formats entries as [DIR] or [FILE], and returns formatted text.
    export async function listDirectory(args?: Record<string, unknown>) {
      const parsed = ListDirectoryArgsSchema.safeParse(args)
      if (!parsed.success) {
        throw new Error(`Invalid arguments for list_directory: ${parsed.error}`)
      }
      const entries = await fs.readdir(parsed.data.path, {
        withFileTypes: true
      })
      const formatted = entries
        .map((entry) => `${entry.isDirectory() ? '[DIR]' : '[FILE]'} ${entry.name}`)
        .join('\n')
      return {
        content: [{ type: 'text', text: formatted }]
      }
    }
  • Zod schema defining the input for list_directory: an object with 'path' string.
    export const ListDirectoryArgsSchema = z.object({
      path: z.string()
    })
  • src/index.ts:136-139 (registration)
    Tool registration in ListToolsRequestHandler: defines name, description (from prompt), and inputSchema.
      name: 'list_directory',
      description: listDirectoryPrompt(args),
      inputSchema: zodToJsonSchema(ListDirectoryArgsSchema) as ToolInput
    },
  • src/index.ts:199-201 (registration)
    Handler dispatch in CallToolRequestHandler switch: calls listDirectory on tool invocation.
    case 'list_directory': {
      return listDirectory(args)
    }
  • Prompt generator for the list_directory tool description, including root paths and usage instructions.
    export const listDirectoryPrompt = (rootPaths: string[]) =>
      `Your task is to list directory under ${rootPaths.join(', ')}. ` +
      'Get a detailed listing of all files and directories in a specified path. ' +
      'Results clearly distinguish between files and directories with [FILE] and [DIR] ' +
      'prefixes. This tool is essential for understanding directory structure and ' +
      'finding specific files within a directory. Only works within allowed directories.'
Behavior3/5

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

With no annotations provided, the description carries the full burden. It discloses key behavioral traits: it provides detailed listings with [FILE] and [DIR] prefixes, and has a constraint ('Only works within allowed directories'). However, it doesn't mention potential limitations like rate limits, error handling, or whether it's read-only (implied but not stated). The description adds useful context but could be more comprehensive.

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

Conciseness3/5

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

The description is moderately concise but could be more front-loaded. It starts with a task-oriented sentence, then details the output format and purpose. However, the first sentence includes an overly specific example path that may not be universally relevant, and the last sentence about being 'essential' is somewhat redundant, reducing efficiency.

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 1 parameter with no schema descriptions, no annotations, and no output schema, the description provides basic completeness: it explains the tool's purpose, output format, and a constraint. However, it lacks details on parameter semantics, error conditions, and exact return structure, making it adequate but with clear gaps for a tool with minimal structured data.

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

Parameters2/5

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

The input schema has 1 parameter with 0% description coverage. The description mentions 'a specified path' and provides a specific example path, but doesn't explain the 'path' parameter's format, constraints, or how it relates to the allowed directories. This adds minimal semantic value beyond what's implied by the schema, insufficiently compensating for the low coverage.

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 tool's purpose: 'list directory' and 'get a detailed listing of all files and directories in a specified path.' It specifies the verb (list/get) and resource (directory/files), but doesn't explicitly differentiate from sibling tools like 'read_file' or 'full_text_search' beyond mentioning it's for understanding directory structure.

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?

The description provides some usage context: 'essential for understanding directory structure and finding specific files within a directory' and 'Only works within allowed directories.' However, it doesn't explicitly state when to use this tool versus alternatives like 'full_text_search' or 'read_file' for file discovery, leaving usage somewhat implied rather than clearly defined.

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

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

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