Skip to main content
Glama

update_note

Modify existing notes in your knowledge base by updating content, tags, or categories to keep information current and organized.

Instructions

Update an existing note's content or tags

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
category_pathYesCategory path (e.g., 'work/clients/acme')
titleYesNote title
contentNoNew content (optional)
tagsNoNew comma-separated tags (optional)
appendNoIf true, append content instead of replacing (default: false)

Implementation Reference

  • MCP handler function for the 'update_note' tool. Parses arguments, calls storage.update_note, and formats success/error response.
    async def handle_update_note(arguments: dict) -> list[TextContent]: """Handle update_note tool call.""" try: category_path = arguments["category_path"] title = arguments["title"] content = arguments.get("content") tags_str = arguments.get("tags") append = arguments.get("append", False) # Parse tags tags = None if tags_str: tags = [tag.strip() for tag in tags_str.split(",") if tag.strip()] # Update note note = storage.update_note( category_path=category_path, title=title, content=content, tags=tags, append=append ) result = f"✓ Note '{title}' updated successfully\n" result += f" Category: {category_path or 'root'}\n" if tags: result += f" Tags: {', '.join(note.frontmatter.tags)}\n" result += f" Last updated: {note.frontmatter.updated}" return [TextContent(type="text", text=result)] except (NoteNotFoundError, StorageError) as e: return [TextContent(type="text", text=str(e))] except Exception as e: return [TextContent(type="text", text=f"❌ Error: {str(e)}")]
  • Registration of the 'update_note' tool in MCP server's list_tools(), including name, description, and inputSchema.
    Tool( name="update_note", description="Update an existing note's content or tags", inputSchema={ "type": "object", "properties": { "category_path": { "type": "string", "description": "Category path (e.g., 'work/clients/acme')", }, "title": { "type": "string", "description": "Note title", }, "content": { "type": "string", "description": "New content (optional)", }, "tags": { "type": "string", "description": "New comma-separated tags (optional)", }, "append": { "type": "boolean", "description": "If true, append content instead of replacing (default: false)", "default": False, }, }, "required": ["category_path", "title"], }, ),
  • Input schema definition for the 'update_note' tool, specifying parameters, types, descriptions, and required fields.
    inputSchema={ "type": "object", "properties": { "category_path": { "type": "string", "description": "Category path (e.g., 'work/clients/acme')", }, "title": { "type": "string", "description": "Note title", }, "content": { "type": "string", "description": "New content (optional)", }, "tags": { "type": "string", "description": "New comma-separated tags (optional)", }, "append": { "type": "boolean", "description": "If true, append content instead of replacing (default: false)", "default": False, }, }, "required": ["category_path", "title"], },
  • Core storage method implementing note update logic: fetches note, applies content/tag updates (with append option), updates timestamp, and writes back to markdown file with backup.
    def update_note( self, category_path: str, title: str, content: Optional[str] = None, tags: Optional[list[str]] = None, append: bool = False, metadata: Optional[dict] = None ) -> Note: """ Update an existing note. Args: category_path: Category path (e.g., "work/clients/acme") title: Note title content: New content (or content to append) tags: New tags (replaces existing) append: If True, append content instead of replacing metadata: Additional metadata to update Returns: Updated Note object Raises: NoteNotFoundError: If note doesn't exist """ # Get existing note normalized = normalize_path(category_path) note = self.get_note(normalized, title) # Update content if content is not None: if append: note.content = note.content.strip() + "\n\n" + content else: note.content = content # Update tags if tags is not None: note.frontmatter.tags = tags # Update metadata if metadata is not None: note.frontmatter.metadata.update(metadata) # Update timestamp note.frontmatter.updated = datetime.now().strftime("%Y-%m-%d") # Write updated note file_path = Path(note.file_path) self._write_note_file(note, file_path, backup=True) return note

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/cwente25/KnowledgeBaseMCP'

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