add_list_item
Add a new item to a checklist note in Google Keep. Specify the note ID, item text, and optionally mark it as checked.
Instructions
Add an item to a checklist note.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| note_id | Yes | ||
| text | Yes | ||
| checked | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- src/server/cli.py:120-131 (handler)The handler function for the 'add_list_item' tool. Decorated with @mcp.tool(), it retrieves a note by ID, verifies it's modifiable and is a List type, adds an item with the given text and checked state, syncs with Google Keep, and returns the note_id and item_id as JSON.
@mcp.tool() def add_list_item(note_id: str, text: str, checked: bool = False) -> str: """Add an item to a checklist note.""" 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.add(text=text, checked=checked) keep.sync() return json.dumps({"note_id": note.id, "item_id": item.id}) - src/server/cli.py:120-120 (registration)Registration of the tool using the @mcp.tool() decorator on the add_list_item function, which registers it with the FastMCP server instance.
@mcp.tool() - src/server/cli.py:17-22 (helper)Helper function _get_note_or_raise used by the handler to look up a note by ID and raise 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)Helper function _ensure_modifiable used by the handler to verify a note can be modified (has keep-mcp label or UNSAFE_MODE is enabled).
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)" )