Skip to main content
Glama

create_note

Create new notes in your Obsidian vault with specified content, file paths, tags, and optional overwrite functionality for organized knowledge management.

Instructions

Create a new note in the vault

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
contentYes
overwriteNo
pathYes
tagsNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • MCP tool handler for 'create_note'. Registers the tool and implements the logic by calling the vault's create_note method, including input validation and frontmatter handling for tags.
    @mcp.tool(name="create_note", description="Create a new note in the vault")
    def create_note(
        path: str, content: str, tags: list[str] | None = None, overwrite: bool = False
    ) -> str:
        """
        Create a new note.
    
        Args:
            path: Relative path for the new note (e.g., "Projects/New Idea.md")
            content: Content of the note
            tags: Optional list of tags to add to frontmatter
            overwrite: If true, overwrite existing note
    
        Returns:
            Success message
        """
        if not path or not path.strip():
            return "Error: Path cannot be empty"
        if len(path) > 1000:
            return "Error: Path too long"
        if len(content) > 1_000_000:
            return "Error: Content too large (max 1MB)"
    
        context = _get_context()
    
        try:
            # Build frontmatter if tags provided
            frontmatter = None
            if tags:
                frontmatter = {"tags": tags}
    
            context.vault.create_note(path, content, frontmatter, overwrite)
            return f"✓ Created note: {path}"
    
        except FileExistsError:
            return f"Error: Note already exists: {path} (use overwrite=true to replace)"
        except VaultSecurityError as e:
            return f"Error: Security violation: {e}"
        except Exception as e:
            logger.exception(f"Error creating note {path}")
            return f"Error creating note: {e}"
  • Core implementation in ObsidianVault class that creates the note file, handles frontmatter insertion, directory creation, and security validation.
    def create_note(
        self,
        relative_path: str,
        content: str,
        frontmatter: dict[str, Any] | None = None,
        overwrite: bool = False,
    ) -> None:
        """
        Create a new note in the vault.
    
        Args:
            relative_path: Path where to create the note
            content: Content of the note
            frontmatter: Optional frontmatter dict
            overwrite: If True, overwrite existing file
    
        Raises:
            VaultSecurityError: If path is invalid
            FileExistsError: If note already exists and overwrite=False
        """
        file_path = self._validate_path(relative_path)
    
        # Check if already exists
        if file_path.exists() and not overwrite:
            raise FileExistsError(f"Note already exists: {relative_path}")
    
        # Ensure parent directory exists
        file_path.parent.mkdir(parents=True, exist_ok=True)
    
        # Build full content with frontmatter
        full_content = ""
        if frontmatter:
            full_content = "---\n"
            full_content += yaml.dump(frontmatter, default_flow_style=False, sort_keys=False)
            full_content += "---\n"
    
        full_content += content
    
        # Write file
        file_path.write_text(full_content, encoding="utf-8")
        logger.info(f"Created note: {relative_path}")
  • The @mcp.tool decorator registers the 'create_note' tool with FastMCP, defining its name, description, and input schema from function signature.
    @mcp.tool(name="create_note", description="Create a new note in the vault")
    def create_note(
        path: str, content: str, tags: list[str] | None = None, overwrite: bool = False
    ) -> str:
        """
        Create a new note.
    
        Args:
            path: Relative path for the new note (e.g., "Projects/New Idea.md")
            content: Content of the note
            tags: Optional list of tags to add to frontmatter
            overwrite: If true, overwrite existing note
    
        Returns:
            Success message
        """
        if not path or not path.strip():
            return "Error: Path cannot be empty"
        if len(path) > 1000:
            return "Error: Path too long"
        if len(content) > 1_000_000:
            return "Error: Content too large (max 1MB)"
    
        context = _get_context()
    
        try:
            # Build frontmatter if tags provided
            frontmatter = None
            if tags:
                frontmatter = {"tags": tags}
    
            context.vault.create_note(path, content, frontmatter, overwrite)
            return f"✓ Created note: {path}"
    
        except FileExistsError:
            return f"Error: Note already exists: {path} (use overwrite=true to replace)"
        except VaultSecurityError as e:
            return f"Error: Security violation: {e}"
        except Exception as e:
            logger.exception(f"Error creating note {path}")
            return f"Error creating note: {e}"
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It states the action ('Create') but doesn't describe what happens on success/failure, whether the note becomes immediately available, what permissions are required, or how the 'overwrite' parameter affects behavior. For a mutation tool with zero annotation coverage, this leaves significant behavioral gaps.

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 extremely concise with a single sentence that gets straight to the point. There's no wasted language or unnecessary elaboration. It's appropriately sized for a basic creation operation.

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 that there's an output schema (which handles return values) and no annotations, the description is minimally complete for stating the core action. However, for a 4-parameter mutation tool with 0% schema coverage and no behavioral annotations, it should provide more context about parameter usage and operational behavior to be truly complete.

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?

With 0% schema description coverage for all 4 parameters, the description provides no information about parameter meanings. It doesn't explain what 'path' format is expected, what 'content' should contain, how 'tags' should be structured, or when 'overwrite' should be used. The description fails to compensate for the complete lack of schema documentation.

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 verb ('Create') and resource ('a new note in the vault'), making the purpose immediately understandable. It distinguishes from siblings like 'append_to_note' or 'update_note' by specifying creation rather than modification. However, it doesn't explicitly differentiate from 'create_from_template' which is also a creation tool.

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 doesn't mention when to choose 'create_note' over 'create_from_template' or 'append_to_note', nor does it indicate any prerequisites or contextual constraints for usage.

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