Skip to main content
Glama
arslankhanali

Apple Notes MCP Server

delete_note

Remove a specific note from Apple Notes by specifying its name and optional account location to manage your note collection.

Instructions

Delete a note by name.

Args:
    note_name: Name of the note to delete
    account: Optional account name where the note is located

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
note_nameYes
accountNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The main handler function for the 'delete_note' tool. It constructs an AppleScript to delete the specified note from Apple Notes.app, handling optional account specification, error handling, and returns success/error messages.
    @mcp.tool()
    async def delete_note(note_name: str, account: Optional[str] = None) -> str:
        """Delete a note by name.
        
        Args:
            note_name: Name of the note to delete
            account: Optional account name where the note is located
        """
        escaped_name = escape_applescript_string(note_name)
        
        if account:
            script = f'''
            tell application "Notes"
                set accountName to "{escape_applescript_string(account)}"
                set noteName to "{escaped_name}"
                try
                    set targetAccount to account accountName
                    set targetNote to note noteName of targetAccount
                    delete targetNote
                    return "SUCCESS"
                on error errMsg
                    return "ERROR: " & errMsg
                end try
            end tell
            '''
        else:
            script = f'''
            tell application "Notes"
                set noteName to "{escaped_name}"
                repeat with anAccount in accounts
                    try
                        set targetNote to note noteName of anAccount
                        delete targetNote
                        return "SUCCESS"
                    end try
                end repeat
                return "ERROR: Note not found"
            end tell
            '''
        
        output, success = run_applescript(script)
        if not success or "ERROR" in output:
            return output if output else f"Failed to delete note '{note_name}'."
        
        return f"Successfully deleted note '{note_name}'."
  • apple_notes.py:350-350 (registration)
    The @mcp.tool() decorator registers the delete_note function as an MCP tool.
    @mcp.tool()
  • Type hints and docstring defining the input schema (note_name: str, optional account: str) and output (str).
    async def delete_note(note_name: str, account: Optional[str] = None) -> str:
        """Delete a note by name.
        
        Args:
            note_name: Name of the note to delete
            account: Optional account name where the note is located
        """
  • Helper function used to escape the note_name for safe inclusion in AppleScript.
    def escape_applescript_string(text: str) -> str:
        """Escape special characters for AppleScript strings."""
        # Replace backslashes, quotes, and newlines
        text = text.replace("\\", "\\\\")
        text = text.replace('"', '\\"')
        text = text.replace("\n", "\\n")
        return text
  • Helper function used by delete_note to execute the AppleScript command.
    def run_applescript(script: str) -> tuple[str, bool]:
        """Run an AppleScript command and return the output."""
        try:
            result = subprocess.run(
                ["osascript", "-e", script],
                capture_output=True,
                text=True,
                timeout=30
            )
            if result.returncode == 0:
                return result.stdout.strip(), True
            else:
                error_msg = result.stderr.strip() or result.stdout.strip()
                return f"Error: {error_msg}", False
        except subprocess.TimeoutExpired:
            return "Error: AppleScript execution timed out", False
        except Exception as e:
            return f"Error: {str(e)}", False
Behavior2/5

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

No annotations are provided, so the description carries full burden. It states the action is deletion (implying destructive behavior) but doesn't disclose critical traits: whether deletion is permanent or reversible, required permissions, error handling (e.g., if note doesn't exist), or side effects. For a destructive tool with zero annotation coverage, this is a significant gap in behavioral context.

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 appropriately sized and front-loaded: the first sentence states the core purpose clearly. The 'Args' section adds parameter details without redundancy. However, the structure could be slightly improved by integrating parameter explanations more seamlessly, and it lacks a concluding note on outcomes, but overall it's efficient with minimal waste.

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?

Given a destructive tool with 2 parameters, 0% schema coverage, no annotations, but an output schema exists (which handles return values), the description is moderately complete. It covers the basic action and parameters but misses behavioral details like safety warnings or error conditions. The output schema reduces the need to explain returns, but more context on the deletion process is warranted for full completeness.

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%, so the schema provides no parameter descriptions. The description adds basic semantics: 'note_name' identifies the note to delete, and 'account' specifies an optional location. However, it doesn't explain format constraints (e.g., note naming rules), default behaviors for 'account', or examples, leaving parameters partially documented but incomplete.

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 the verb ('Delete') and resource ('a note by name'), making the purpose immediately understandable. It distinguishes from siblings like 'create_note' or 'update_note' by specifying deletion. However, it doesn't explicitly differentiate from other destructive operations like 'delete_account' if such existed, keeping it at 4 rather than 5.

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?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., note must exist), exclusions (e.g., cannot delete system notes), or comparisons to siblings like 'update_note' for modification instead of deletion. This leaves the agent without contextual usage cues.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/arslankhanali/apple-notes-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server