Skip to main content
Glama

create_note

Create and organize notes with titles, content, and folders directly from Claude conversations using the NotePlan MCP Server interface.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
contentNoThe content of the note
folderNoThe folder to create the note in
titleYesThe title of the note

Implementation Reference

  • src/index.ts:92-110 (registration)
    Registers the 'create_note' MCP tool, defining input schema with Zod and a handler that delegates to noteService.createNote, returning the new note as JSON text.
    server.tool( 'create_note', { title: z.string().describe('The title of the note'), content: z.string().optional().describe('The content of the note'), folder: z.string().optional().describe('The folder to create the note in'), }, async ({ title, content, folder }) => { const newNote = noteService.createNote({ title, content, folder }); return { content: [ { type: 'text', text: JSON.stringify(newNote, null, 2), }, ], }; } );
  • Core implementation of note creation: validates title, sanitizes for filename, writes Markdown file to NotePlan's Notes directory (or subfolder), parses back to Note object; falls back to in-memory mock DB.
    function createNote(noteData: CreateNoteParams): Note { if (!noteData.title) { throw new Error('Note title is required'); } const now = new Date(); const timestamp = now.toISOString(); // Generate filename from title (sanitize for filesystem) const sanitizedTitle = noteData.title .replace(/[^a-zA-Z0-9\s-_]/g, '') .replace(/\s+/g, '-') .substring(0, 50); const filename = `${sanitizedTitle}-${Date.now()}`; const noteId = `note-${filename}`; // Prepare content with title as markdown header const content = noteData.content ? `# ${noteData.title}\n\n${noteData.content}` : `# ${noteData.title}\n\n`; if (isNotePlanAvailable()) { // Determine target directory const targetFolder = noteData.folder || 'Notes'; let targetPath = NOTES_PATH; if (targetFolder !== 'Notes' && targetFolder !== 'Calendar') { targetPath = path.join(NOTES_PATH, targetFolder); // Create subfolder if it doesn't exist if (!fs.existsSync(targetPath)) { fs.mkdirSync(targetPath, { recursive: true }); } } const filePath = path.join(targetPath, `${filename}.md`); try { fs.writeFileSync(filePath, content, 'utf8'); // Clear cache to force refresh notesCache = []; lastCacheUpdate = 0; // Return the newly created note return parseMarkdownFile(filePath, targetFolder)!; } catch (error) { throw new Error(`Failed to create note: ${(error as Error).message}`); } } else { // Fallback to mock database const newNote: Note = { id: noteId, title: noteData.title, content, created: timestamp, modified: timestamp, folder: noteData.folder || 'Notes' }; notesDb.push(newNote); return newNote; } }
  • TypeScript interface defining parameters for createNote function.
    interface CreateNoteParams { title: string; content?: string; folder?: string; }
  • Zod schema for 'create_note' tool input validation in MCP server registration.
    { title: z.string().describe('The title of the note'), content: z.string().optional().describe('The content of the note'), folder: z.string().optional().describe('The folder to create the note in'), },
  • src/index.js:96-115 (registration)
    Alternative Express-based handler for 'createNote' command (note camelCase), validating title and calling noteService.createNote.
    case 'createNote': try { if (!args.title) { return res.status(400).json({ error: 'Missing required parameter: title', status: 'error' }); } const newNote = noteService.createNote(args); return res.json({ result: newNote, status: 'success' }); } catch (error) { return res.status(400).json({ error: error.message, status: 'error' }); }

Other Tools

Related 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/bscott/noteplan-mcp'

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