Skip to main content
Glama

obsidian_list_files_in_vault

Read-onlyIdempotent

View the top-level structure of your Obsidian vault to understand organization and locate folders for Zettelkasten notes.

Instructions

List all files and directories in the vault root.

This tool shows the top-level structure of your Obsidian vault, helping you
understand the organization and locate folders for Zettelkasten notes.

Returns:
    str: Formatted list of directories and files in the vault root
    
Example:
    Returns a markdown-formatted list showing all top-level folders and files.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • Registration of the obsidian_list_files_in_vault tool using @mcp.tool decorator with name and annotations.
    @mcp.tool(
        name="obsidian_list_files_in_vault",
        annotations={
            "title": "List Files in Vault Root",
            "readOnlyHint": True,
            "destructiveHint": False,
            "idempotentHint": True,
            "openWorldHint": False
        }
    )
  • Handler function implementing the core logic: calls ObsidianClient.get('/vault/') to retrieve files and directories, formats them using format_file_list, handles errors.
    async def list_files_in_vault() -> str:
        """List all files and directories in the vault root.
        
        This tool shows the top-level structure of your Obsidian vault, helping you
        understand the organization and locate folders for Zettelkasten notes.
        
        Returns:
            str: Formatted list of directories and files in the vault root
            
        Example:
            Returns a markdown-formatted list showing all top-level folders and files.
        """
        try:
            result = await obsidian_client.get("/vault/")
            files = result.get("files", [])
            directories = result.get("directories", [])
            
            return format_file_list(files, directories)
            
        except ObsidianAPIError as e:
            return json.dumps({
                "error": str(e),
                "success": False
            }, indent=2)
  • Helper function that formats the lists of files and directories into a markdown-formatted response for the user.
    def format_file_list(files: List[str], directories: List[str]) -> str:
        """Format file and directory lists for display."""
        result = []
        
        if directories:
            result.append("## Directories")
            for d in sorted(directories):
                result.append(f"- 📁 {d}/")
            result.append("")
        
        if files:
            result.append("## Files")
            for f in sorted(files):
                result.append(f"- 📄 {f}")
        
        return "\n".join(result) if result else "No files or directories found."
Behavior4/5

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

Annotations already indicate read-only, non-destructive, and idempotent behavior, which the description does not contradict. The description adds valuable context beyond annotations by specifying that it returns a 'markdown-formatted list' and helps 'understand the organization and locate folders for Zettelkasten notes,' enhancing behavioral understanding without redundancy.

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 well-structured and concise, with three sentences that each serve a distinct purpose: stating the tool's function, explaining its utility, and detailing the return format with an example. There is no wasted text, and information is front-loaded effectively.

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 (0 parameters, annotations covering safety, and an output schema implied by the description), the description is complete. It explains what the tool does, why to use it, and the return format, which is sufficient since the output schema handles return values. No gaps are present for this context.

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?

With 0 parameters and 100% schema description coverage, the baseline is 4. The description appropriately does not discuss parameters, as none exist, and instead focuses on the tool's output and purpose, adding meaningful context without unnecessary detail.

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 specific action ('List all files and directories'), target resource ('in the vault root'), and scope ('top-level structure'), distinguishing it from sibling tools like 'obsidian_list_files_in_dir' which would handle subdirectories. It explicitly mentions the purpose of understanding vault organization and locating folders for Zettelkasten notes.

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 provides clear context for when to use this tool ('List all files and directories in the vault root'), but does not explicitly state when not to use it or name alternatives. It implies usage for top-level exploration, which differentiates it from directory-specific listing tools, but lacks explicit exclusions or comparisons.

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

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