remove_note_collaborator
Remove a collaborator email from a Google Keep note. Provide the note ID and the collaborator's email to revoke access.
Instructions
Remove a collaborator email from a note.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| note_id | Yes | ||
| Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- src/server/cli.py:357-365 (handler)The handler function for the remove_note_collaborator tool. It fetches the note by ID, ensures it can be modified, removes the collaborator email from the note, syncs with Google Keep, and returns the updated note as JSON.
@mcp.tool() def remove_note_collaborator(note_id: str, email: str) -> str: """Remove a collaborator email from a note.""" keep, note = _get_note_or_raise(note_id) _ensure_modifiable(note) note.collaborators.remove(email) keep.sync() return json.dumps(serialize_note(note)) - src/server/cli.py:357-358 (registration)The tool is registered using the @mcp.tool() decorator from FastMCP, which registers it as an MCP tool named 'remove_note_collaborator'.
@mcp.tool() def remove_note_collaborator(note_id: str, email: str) -> str: - src/server/cli.py:17-22 (helper)Helper function that retrieves a note by ID or raises an error if not found. Used by remove_note_collaborator.
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 that checks if a note can be modified before performing operations like removing a collaborator.
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 collaborators list) to a dictionary 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