Skip to main content
Glama

list_notes

Retrieve notes from your Obsidian vault with folder filtering, recursive search options, and result limits for organized content management.

Instructions

List notes in the vault with optional filters

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
folderNo
limitNo
recursiveNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • MCP tool handler for list_notes: validates inputs, calls vault.list_notes, formats results as numbered list with path, size, and tags.
    @mcp.tool(name="list_notes", description="List notes in the vault with optional filters")
    def list_notes(folder: str = "", recursive: bool = True, limit: int = 100) -> str:
        """
        List notes in the vault.
    
        Args:
            folder: Folder to list (empty for root)
            recursive: Include subfolders (default: true)
            limit: Maximum number of results (default: 100)
    
        Returns:
            Formatted list of notes with metadata
        """
        # Validate input
        if limit <= 0 or limit > 10000:
            return "Error: Limit must be between 1 and 10000"
    
        context = _get_context()
    
        try:
            notes = context.vault.list_notes(folder=folder, recursive=recursive, limit=limit)
    
            if not notes:
                folder_desc = f" in '{folder}'" if folder else ""
                return f"No notes found{folder_desc}"
    
            # Format results
            folder_desc = f" in '{folder}'" if folder else ""
            output = f"Found {len(notes)} notes{folder_desc}:\n\n"
    
            for i, note in enumerate(notes, 1):
                output += f"{i}. **{note.name}**\n"
                output += f"   Path: `{note.path}`\n"
                output += f"   Size: {note.size} bytes\n"
    
                if note.tags:
                    output += f"   Tags: {', '.join(note.tags)}\n"
    
                output += "\n"
    
            return output
    
        except VaultSecurityError as e:
            return f"Error: Security violation: {e}"
        except Exception as e:
            logger.exception("Error listing notes")
            return f"Error listing notes: {e}"
  • Core implementation: scans vault directory (recursive or not), filters markdown files, extracts metadata (path, name, size, modified, optional tags), sorts by recency, returns list of NoteMetadata.
    def list_notes(
        self,
        folder: str = "",
        recursive: bool = True,
        limit: int | None = None,
        include_tags: bool = False,
    ) -> list[NoteMetadata]:
        """
        List notes in the vault.
    
        Args:
            folder: Subfolder to list (empty for root)
            recursive: Include subfolders
            limit: Maximum number of results
            include_tags: Whether to extract tags (slower)
    
        Returns:
            List of note metadata
        """
        start_path = self.vault_path
        if folder:
            start_path = self._validate_path(folder)
    
        notes: list[NoteMetadata] = []
        count = 0
        max_count = limit or self.config.max_results
    
        pattern = "**/*" if recursive else "*"
    
        for file_path in start_path.glob(pattern):
            if count >= max_count:
                break
    
            if not file_path.is_file():
                continue
    
            if self._is_excluded(file_path):
                continue
    
            if file_path.suffix not in self.config.file_extensions:
                continue
    
            relative_path = str(file_path.relative_to(self.vault_path))
            stats = file_path.stat()
    
            # Read file to extract tags (only if requested)
            if include_tags:
                try:
                    content = file_path.read_text(encoding="utf-8")
                    frontmatter, _ = self._parse_frontmatter(content)
                    tags = self._extract_tags(content, frontmatter)
                except (OSError, UnicodeDecodeError, yaml.YAMLError) as e:
                    logger.debug(f"Failed to extract tags from {file_path}: {e}")
                    tags = []
            else:
                tags = []
    
            notes.append(
                NoteMetadata(
                    path=relative_path,
                    name=file_path.stem,
                    extension=file_path.suffix,
                    size=stats.st_size,
                    modified=stats.st_mtime,
                    tags=tags,
                )
            )
            count += 1
    
        # Sort by modification time (newest first)
        notes.sort(key=lambda n: n.modified, reverse=True)
    
        return notes
  • Tool registration decorator specifying the name 'list_notes' and description.
    @mcp.tool(name="list_notes", description="List notes in the vault with optional filters")
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 states the tool lists notes with filters but does not describe key behaviors such as pagination (implied by 'limit' parameter), default sorting, error handling, or whether it returns metadata or full content. This leaves significant gaps in understanding how the tool operates.

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, efficient sentence that front-loads the core purpose ('List notes in the vault') and adds essential qualification ('with optional filters'). There is no wasted language, and it is appropriately sized for a basic 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 moderate complexity (3 parameters, no annotations, but with an output schema), the description is incomplete. It covers the basic purpose but lacks details on behavior, parameter usage, and differentiation from siblings. The presence of an output schema mitigates the need to describe return values, but other gaps remain significant.

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 description mentions 'optional filters' but does not specify what parameters are available or their meanings. With 0% schema description coverage and 3 parameters (folder, limit, recursive), the schema provides titles but no descriptions. The description adds minimal value by hinting at filtering but fails to compensate for the low schema coverage, resulting in inadequate parameter documentation.

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

Purpose3/5

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

The description states the tool's purpose as 'List notes in the vault with optional filters', which clearly indicates it retrieves notes with filtering capabilities. However, it does not differentiate from sibling tools like 'search_notes', 'get_notes_by_tag', or 'list_daily_notes', leaving ambiguity about when to use this specific listing tool versus others.

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. It mentions 'optional filters' but does not specify what types of filters are available or how they compare to filtering in sibling tools like 'search_notes'. There is no mention of prerequisites, exclusions, or recommended contexts for use.

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/getglad/obsidian_mcp'

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