create_note
Create a new Markdown note with title, content, and optional tags to organize your thoughts and documentation in a structured format.
Instructions
Create a new Markdown note
Args: title: Note title content: Note content tags: Optional comma-separated list of tags
Returns: Confirmation message of note creation
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| title | Yes | ||
| content | Yes | ||
| tags | No |
Implementation Reference
- notes_server.py:21-49 (handler)The handler function that implements the 'create_note' tool logic. Decorated with @mcp.tool() for automatic registration in the MCP server. Includes type annotations and docstring defining the input schema. Creates a new note file with timestamped sanitized filename, formats Markdown content with metadata, writes to disk, and returns confirmation.@mcp.tool() def create_note(title: str, content: str, tags: str = "") -> str: """ Create a new Markdown note Args: title: Note title content: Note content tags: Optional comma-separated list of tags Returns: Confirmation message of note creation """ ensure_notes_dir() timestamp = datetime.now().strftime("%Y%m%d_%H%M%S") filename = f"{timestamp}_{sanitize_filename(title)}.md" filepath = os.path.join(NOTES_DIR, filename) note_content = f"# {title}\n\n" note_content += f"**Created:** {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}\n" if tags: note_content += f"**Tags:** {tags}\n" note_content += f"\n---\n\n{content}\n" with open(filepath, "w", encoding="utf-8") as f: f.write(note_content) return f"Note '{title}' created: {filename}"