trash_note
Move a note to the trash using its note ID. Remove unwanted notes from your active list.
Instructions
Move a note to trash.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| note_id | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- src/server/cli.py:226-234 (handler)The trash_note tool handler: retrieves the note, checks if modifiable, calls note.trash(), syncs, and returns the serialized note as JSON.
@mcp.tool() def trash_note(note_id: str) -> str: """Move a note to trash.""" keep, note = _get_note_or_raise(note_id) _ensure_modifiable(note) note.trash() keep.sync() return json.dumps(serialize_note(note)) - src/server/cli.py:226-226 (registration)The @mcp.tool() decorator registers trash_note as an MCP tool.
@mcp.tool() - src/server/keep_api.py:71-105 (helper)serialize_note helper serializes the note (including trashed status) to a dict for JSON output.
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 - tests/test_cli.py:87-88 (helper)DummyNote.trash() test helper used in testing the trash_note tool.
def trash(self): self.trashed = True - tests/test_cli.py:308-313 (helper)Test asserting trash_note sets trashed=True on the note.
def test_note_state_transitions(keep): assert json.loads(cli.set_note_color("n1", "red"))["color"] == "red" assert json.loads(cli.pin_note("n1", True))["pinned"] is True assert json.loads(cli.archive_note("n1", True))["archived"] is True assert json.loads(cli.trash_note("n1"))["trashed"] is True assert json.loads(cli.restore_note("n1"))["trashed"] is False