Skip to main content
Glama
feuerdev
by feuerdev

add_label_to_note

Attach a label to a note by specifying both the note ID and the label ID.

Instructions

Add a label to a note.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
note_idYes
label_idYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The MCP tool handler that adds a label to a note. It looks up the note and label by ID, ensures the note is modifiable, then adds the label and syncs.
    @mcp.tool()
    def add_label_to_note(note_id: str, label_id: str) -> str:
        """Add a label to 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")
    
        note.labels.add(label)
        keep.sync()
        return json.dumps(serialize_note(note))
  • The @mcp.tool() decorator registers add_label_to_note as an MCP tool.
    @mcp.tool()
  • Helper function used by add_label_to_note to fetch the note and client, raising if note 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
  • Helper function used by add_label_to_note to verify the note is modifiable (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)"
            )

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv0.3.1

TDQS

C2.6/5.0
Behavior2/5

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

There are no annotations, so the description must carry the burden of behavioral disclosure. It only states the mutation itself and says nothing about side effects, idempotency, whether duplicate labels are rejected, or what happens if the note or label does not exist.

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

Conciseness4/5

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

The description is one short, front-loaded sentence with no filler. It is concise, though slightly terse; it provides the core operation but sacrifices useful context for brevity.

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

Completeness2/5

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

While the tool is simple, the absence of annotations and parameter descriptions leaves important context missing, such as preconditions and behavior on duplicate labels. The output schema may cover return values, but the description does not make the tool complete enough to invoke confidently.

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

Parameters1/5

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

The input schema has 0% description coverage, and the description adds no clarification beyond the parameter names. It does not explain that note_id must reference an existing note, that label_id must reference an existing label, or how those IDs should be obtained.

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

Purpose4/5

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

The description clearly states a specific verb and resource: adding a label to a note. It is immediately understandable and distinguishable from the remove_label_from_note sibling by the opposite direction of action, though it does not explicitly name or contrast any sibling.

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 given about when to use this tool versus related tools like create_label, list_labels, or remove_label_from_note. There are also no stated prerequisites, such as the note and label already existing or how to obtain their IDs.

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