update_list_item
Update the text or checked status of an existing checklist item in a Google Keep note by specifying the note and item IDs.
Instructions
Update checklist item text and/or checked state.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| note_id | Yes | ||
| item_id | Yes | ||
| text | No | ||
| checked | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- src/server/cli.py:134-153 (handler)The main handler function for the update_list_item MCP tool. Updates a checklist item's text and/or checked state, validates the note is a list, and returns the serialized note.
@mcp.tool() def update_list_item(note_id: str, item_id: str, text: str | None = None, checked: bool | None = None) -> str: """Update checklist item text and/or checked state.""" keep, note = _get_note_or_raise(note_id) _ensure_modifiable(note) if not isinstance(note, gkeepapi.node.List): raise ValueError(f"Note with ID {note_id} is not a list") item = note.get(item_id) if not item: raise ValueError(f"List item with ID {item_id} not found") if text is not None: item.text = text if checked is not None: item.checked = checked keep.sync() return json.dumps(serialize_note(note)) - src/server/cli.py:134-134 (registration)The @mcp.tool() decorator registers the function as an MCP tool named 'update_list_item'.
@mcp.tool() - src/server/cli.py:17-22 (helper)Helper used by the handler to retrieve the note and raise 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)Helper used by the handler to ensure the note can be modified.
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)Helper function that serializes a note (including its list items) to a dict, used by the handler to produce the return value.
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