update_note
Update the title or text of an existing note by providing its ID. Modify note properties without replacing the entire note.
Instructions
Update a note's properties.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| note_id | Yes | ||
| title | No | ||
| text | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- src/server/cli.py:174-186 (handler)The actual update_note tool handler function. Uses @mcp.tool() decorator. Retrieves the note via _get_note_or_raise, validates it with _ensure_modifiable, updates title/text if provided, syncs via keep, and returns serialized note JSON.
@mcp.tool() def update_note(note_id: str, title: str | None = None, text: str | None = None) -> str: """Update a note's properties.""" keep, note = _get_note_or_raise(note_id) _ensure_modifiable(note) if title is not None: note.title = title if text is not None: note.text = text keep.sync() return json.dumps(serialize_note(note)) - src/server/cli.py:14-14 (registration)The @mcp.tool() decorator on line 174 registers update_note as an MCP tool with FastMCP instance created here.
mcp = FastMCP("keep") - src/server/cli.py:17-22 (helper)_get_note_or_raise helper: retrieves the Keep client and note by ID, raises ValueError if not found.
def _get_note_or_raise(note_id: str): keep = get_client() note = keep.get(note_id) if not note: raise ValueError(f"Note with ID {note_id} not found") return keep, note - src/server/cli.py:25-30 (helper)_ensure_modifiable helper: checks if the note can be modified (has keep-mcp label or UNSAFE_MODE enabled), raises ValueError if not.
def _ensure_modifiable(note): if not can_modify_note(note): raise ValueError( f"Note with ID {note.id} cannot be modified " "(missing keep-mcp label and UNSAFE_MODE is not enabled)" ) - src/server/keep_api.py:71-105 (helper)serialize_note helper: converts a Keep note object to a dictionary for JSON response.
def serialize_note(note): """ Serialize a Google Keep note into a dictionary. Args: note: A Google Keep note object Returns: dict: A dictionary containing the note's id, title, text, pinned status, color and labels """ payload = { 'id': note.id, 'title': note.title, 'text': note.text, 'type': note.type.value, 'pinned': note.pinned, 'archived': note.archived, 'trashed': note.trashed, 'color': note.color.value if note.color else None, 'labels': [serialize_label(label) for label in note.labels.all()], 'collaborators': list(note.collaborators.all()), } if hasattr(note, 'items'): payload['items'] = [serialize_list_item(item) for item in note.items] payload['media'] = [ { 'blob_id': blob.id, 'type': blob.blob.type.value if blob.blob and blob.blob.type else None, } for blob in note.blobs ] return payload