Skip to main content
Glama
feuerdev
by feuerdev

remove_label_from_note

Removes a label from a Google Keep note. Provide the note ID and label ID to detach the label.

Instructions

Remove a label from a note.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
note_idYes
label_idYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The main handler function for the 'remove_label_from_note' MCP tool. It retrieves the note by ID, ensures the note is modifiable, looks up the label by ID (raising an error if not found), protects the 'keep-mcp' label in safe mode, removes the label from the note, syncs with Google Keep, and returns the updated note as JSON.
    @mcp.tool()
    def remove_label_from_note(note_id: str, label_id: str) -> str:
        """Remove a label from a note."""
        keep, note = _get_note_or_raise(note_id)
        _ensure_modifiable(note)
    
        label = keep.getLabel(label_id)
        if not label:
            raise ValueError(f"Label with ID {label_id} not found")
        if label.name == KEEP_MCP_LABEL and not is_unsafe_mode():
            raise ValueError(
                f"Cannot remove the '{KEEP_MCP_LABEL}' label in safe mode: the note would "
                "become permanently unmodifiable. Set UNSAFE_MODE=true to override."
            )
    
        note.labels.remove(label)
        keep.sync()
        return json.dumps(serialize_note(note))
  • Helper that fetches a note by ID using the Keep client, raising ValueError if not found. Returns both the client and the note.
    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
  • Helper that checks if a note is modifiable (has keep-mcp label or UNSAFE_MODE is enabled), raising 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)"
            )
  • Helper that checks the UNSAFE_MODE environment variable to determine if safety restrictions should be bypassed.
    def is_unsafe_mode() -> bool:
        return os.getenv('UNSAFE_MODE', '').lower() == 'true'
  • Serializes a note object into a dictionary (id, title, text, type, pinned, archived, trashed, color, labels, collaborators, items, media) 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

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv0.3.1

TDQS

A3.5/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description must disclose behavior on its own. It accurately states the core mutating action, but it does not clarify whether the label is merely disassociated from the note or deleted, nor what happens if the label is not already attached. This is a minimal but not misleading disclosure.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

A single, clear, front-loaded sentence contains exactly the necessary information with no filler. It earns its place efficiently.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a two-parameter tool with an output schema, the description covers the basic operation but lacks guidance on edge cases, side effects, and alternative tool selection. It is adequate for straightforward use but not richly contextual.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, and the description does not enumerate or explain note_id and label_id explicitly. However, the phrase 'from a note' plus the parameter names makes the roles of the two IDs clear enough for a simple operation.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states a specific verb ('Remove') and a specific resource ('a label from a note'). It is immediately distinguishable from sibling tools like add_label_to_note and delete_label, so the agent knows exactly what this tool does.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided about when to use this tool versus alternatives such as delete_label or add_label_to_note. The intended use is inferable from the name, but the description does not explicitly state when-not or mention any prerequisites or edge conditions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.