create_note
Create a new markdown note in an Obsidian vault. Specify the vault-relative path and full markdown content including frontmatter.
Instructions
Create a new markdown note in the Obsidian vault. Requires a readwrite API key.
See get_vault_guide for Obsidian syntax and any vault-specific conventions
(naming, folder placement, frontmatter, tags).
Args: path: Vault-relative path for the new note (e.g. "Cards/New Topic.md"). The .md extension is added if missing. content: Full markdown content for the note, including any frontmatter.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | ||
| content | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- src/mcp_server/tools.py:299-318 (handler)Core implementation of create_note tool. Validates write permission, checks content size (max 10MB), appends .md extension if missing, validates path, checks for existing note, and writes the file.
@_tracked("create_note", ["path"]) async def create_note_impl(path: str, content: str) -> str: """Create a new note in the vault.""" if err := _require_write(): return err encoded = content.encode("utf-8") if len(encoded) > MAX_NOTE_BYTES: return f"Content too large ({len(encoded)} bytes, max {MAX_NOTE_BYTES})" if not path.endswith(".md"): path += ".md" uid = current_user_id.get() try: from src.services.vault import validate_path full_path = validate_path(path, user_id=uid) if full_path.exists(): return f"Note already exists: {path}. Use edit_note to modify it." write_file(path, content, user_id=uid) return f"Created note: {path}" except ValueError as e: return str(e) - src/mcp_server/server.py:160-171 (handler)MCP tool decorator that exposes create_note as a tool. It is the public-facing endpoint that delegates to create_note_impl.
@mcp.tool() async def create_note(path: str, content: str) -> str: """Create a new markdown note in the Obsidian vault. Requires a readwrite API key. See `get_vault_guide` for Obsidian syntax and any vault-specific conventions (naming, folder placement, frontmatter, tags). Args: path: Vault-relative path for the new note (e.g. "Cards/New Topic.md"). The .md extension is added if missing. content: Full markdown content for the note, including any frontmatter. """ return await create_note_impl(path, content) - src/mcp_server/server.py:5-6 (registration)Import of create_note_impl from tools module into the server, making it available for the MCP tool registration.
from src.mcp_server.tools import ( create_note_impl, - src/mcp_server/tools.py:289-293 (helper)Helper function that checks if the current API key has write permission. Returns an error string if read-only.
def _require_write() -> str | None: """Return an error message if current key lacks write permission.""" if current_permission.get() != "readwrite": return "Permission denied: this API key has read-only access. A 'readwrite' key is required." return None - src/mcp_server/tools.py:296-296 (helper)Constant defining the maximum note size: 10 MB.
MAX_NOTE_BYTES = 10 * 1024 * 1024 # 10 MB