Skip to main content
Glama
maxkuminov

Obsidian MCP (pgvector + Ollama, self-hosted)

read_note

Retrieve a note from your Obsidian vault by specifying its relative path. Access note content for reading or downstream processing.

Instructions

Read a note from the Obsidian vault by its relative path.

Args: path: Vault-relative path to the note (e.g. "Cards/My Note.md")

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The actual implementation of read_note_impl — reads a note by vault-relative path, assembles markdown output with title, path, tags, frontmatter, and content.
    @_tracked("read_note", ["path"])
    async def read_note_impl(path: str) -> str:
        """Read a note by its vault-relative path."""
        uid = current_user_id.get()
        try:
            note = read_file(path, user_id=uid)
        except FileNotFoundError:
            return f"Note not found: {path}"
        except ValueError as e:
            return str(e)
    
        parts = [f"# {note['title']}\n**Path:** `{note['path']}`"]
        if note["tags"]:
            parts.append(f"**Tags:** {', '.join(note['tags'])}")
        if note["frontmatter"]:
            fm_lines = [f"  {k}: {v}" for k, v in note["frontmatter"].items() if k not in ("title", "tags")]
            if fm_lines:
                parts.append("**Frontmatter:**\n" + "\n".join(fm_lines))
        parts.append(f"\n---\n{note['content']}")
        return "\n".join(parts)
  • The read_file helper that reads a note file from disk, parses YAML frontmatter, extracts tags, and returns a dict with path, title, frontmatter, tags, content, size, and modified time.
    def read_file(relative_path: str, user_id: int | None = None) -> dict:
        """Read a note, returning frontmatter + content."""
        path = validate_path(relative_path, user_id=user_id)
        if not path.is_file():
            raise FileNotFoundError(f"Note not found: {relative_path}")
        raw = path.read_text(encoding="utf-8")
        frontmatter, content = parse_frontmatter(raw)
        title = frontmatter.get("title") or path.stem
        tags = extract_tags(raw, frontmatter)
        return {
            "path": relative_path,
            "title": title,
            "frontmatter": frontmatter,
            "tags": tags,
            "content": content,
            "size": path.stat().st_size,
            "modified": path.stat().st_mtime,
        }
  • The MCP tool decorator registration for 'read_note', which delegates to read_note_impl.
    @mcp.tool()
    async def read_note(path: str) -> str:
        """Read a note from the Obsidian vault by its relative path.
    
        Args:
            path: Vault-relative path to the note (e.g. "Cards/My Note.md")
        """
        return await read_note_impl(path)
  • Type signature and docstring: read_note takes a 'path: str' and returns 'str'.
    """Read a note from the Obsidian vault by its relative path.
    
    Args:
        path: Vault-relative path to the note (e.g. "Cards/My Note.md")
    """
    return await read_note_impl(path)
  • The _tracked decorator used on read_note_impl to log tool usage timing and parameters.
    def _tracked(tool_name: str, param_keys: list[str]):
        """Decorator that times the call and logs it to usage_logs."""
        def decorator(fn):
            @wraps(fn)
            async def wrapper(*args, **kwargs):
                start = time.monotonic()
                result = await fn(*args, **kwargs)
                duration_ms = int((time.monotonic() - start) * 1000)
                params = {}
                for i, key in enumerate(param_keys):
                    if i < len(args):
                        params[key] = args[i]
                    elif key in kwargs:
                        params[key] = kwargs[key]
                await _log_usage(tool_name, _truncate_params(params), duration_ms, len(str(result)))
                return result
            return wrapper
        return decorator
Behavior2/5

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

No annotations provided, so the description bears full burden. It does not disclose behavioral traits like error handling, permission requirements, or whether the note is locked during read. It simply states 'Read a note'.

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

Conciseness4/5

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

The description is concise with two sentences and a docstring section. It is front-loaded with the main purpose, but could be more structured with explicit sections.

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

Completeness4/5

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

For a simple read operation, the description is fairly complete. It explains the parameter and purpose. However, it could mention what happens if the path is invalid or if the note doesn't exist.

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?

The description adds meaning to the 'path' parameter by specifying it is vault-relative and providing an example. Schema coverage is 0%, but the docstring compensates well.

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 reads a note from the Obsidian vault by relative path, using specific verb and resource. It distinguishes from sibling tools like create_note or delete_note.

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?

No guidance on when to use this tool versus alternatives such as get_recent or get_neighborhood. The description only explains the function.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

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

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