Skip to main content
Glama

create_note

Create new notes with structured frontmatter and content in Obsidian vaults to organize knowledge effectively.

Instructions

Create a new note with optional frontmatter and content

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYesRelative path like 'folder/note.md'
contentYesNote content
frontmatterNoJSON string of key-value pairs to add as YAML frontmatter

Implementation Reference

  • Registration of the 'create_note' tool in the MCP server.
    server.registerTool(
      "create_note",
      {
        description: "Create a new note with optional frontmatter and content",
        inputSchema: {
          path: z.string().min(1).describe("Relative path like 'folder/note.md'"),
          content: z.string().describe("Note content"),
          frontmatter: z
            .string()
            .optional()
            .describe("JSON string of key-value pairs to add as YAML frontmatter"),
        },
      },
      async ({ path: notePath, content, frontmatter }) => {
        try {
          const resolvedPath = ensureMdExtension(notePath);
    
          if (await noteExists(vaultPath, resolvedPath)) {
            return errorResult(`Error: Note already exists at '${resolvedPath}'. Use append or update tools instead.`);
          }
    
          let finalContent: string;
    
          if (frontmatter) {
            let parsed: Record<string, unknown>;
            try {
              parsed = JSON.parse(frontmatter) as Record<string, unknown>;
            } catch {
              return errorResult("Error: Invalid JSON in frontmatter parameter.");
            }
            finalContent = buildFrontmatterContent(parsed, content);
          } else {
            finalContent = content;
          }
    
          await writeNote(vaultPath, resolvedPath, finalContent);
          return textResult(`Created note at '${resolvedPath}'.`);
        } catch (err) {
          console.error("create_note error:", err);
          return errorResult(`Error creating note: ${err instanceof Error ? err.message : String(err)}`);
        }
      },
    );
  • The handler function implementation for the 'create_note' tool, which handles path resolution, frontmatter parsing, and writing the note content.
    async ({ path: notePath, content, frontmatter }) => {
      try {
        const resolvedPath = ensureMdExtension(notePath);
    
        if (await noteExists(vaultPath, resolvedPath)) {
          return errorResult(`Error: Note already exists at '${resolvedPath}'. Use append or update tools instead.`);
        }
    
        let finalContent: string;
    
        if (frontmatter) {
          let parsed: Record<string, unknown>;
          try {
            parsed = JSON.parse(frontmatter) as Record<string, unknown>;
          } catch {
            return errorResult("Error: Invalid JSON in frontmatter parameter.");
          }
          finalContent = buildFrontmatterContent(parsed, content);
        } else {
          finalContent = content;
        }
    
        await writeNote(vaultPath, resolvedPath, finalContent);
        return textResult(`Created note at '${resolvedPath}'.`);
      } catch (err) {
        console.error("create_note error:", err);
        return errorResult(`Error creating note: ${err instanceof Error ? err.message : String(err)}`);
      }
    },
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. It mentions 'Create a new note', implying a write operation, but lacks details on permissions, error handling, or what happens if a note already exists at the path. This leaves behavioral traits unclear for a mutation tool.

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 directly states the tool's function without unnecessary words. It is front-loaded and wastes no space, making it highly concise and well-structured.

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

Completeness2/5

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

Given no annotations and no output schema, the description is incomplete for a mutation tool. It does not cover behavioral aspects like side effects, error conditions, or return values, leaving gaps that could hinder an AI agent's ability to use the tool correctly in context.

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?

Schema description coverage is 100%, so the schema fully documents parameters like 'path', 'content', and 'frontmatter'. The description adds minimal value by noting that frontmatter and content are optional, but this is already implied by the schema's required fields. Baseline score of 3 is appropriate as the schema handles most semantics.

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 action ('Create a new note') and specifies what can be included ('optional frontmatter and content'), making the purpose evident. However, it does not explicitly differentiate from sibling tools like 'create_daily_note' or 'append_to_note', which would require more specific context about when to use each.

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. With siblings like 'create_daily_note', 'append_to_note', and 'prepend_to_note', there is no indication of scenarios, prerequisites, or exclusions for choosing this tool over others.

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

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