Skip to main content
Glama
arslankhanali

Apple Notes MCP Server

update_note

Modify existing Apple Notes content by specifying the note name and providing new text, optionally selecting the account where the note is stored.

Instructions

Update the content of an existing note.

Args:
    note_name: Name of the note to update
    new_content: New content for the note
    account: Optional account name where the note is located

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
note_nameYes
new_contentYes
accountNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The @mcp.tool() decorator registers and defines the handler for the 'update_note' tool. It escapes the note name and content, constructs an AppleScript to find and update the note's body (searching all accounts if no account specified), executes it via subprocess, and returns success/error messages.
    @mcp.tool()
    async def update_note(note_name: str, new_content: str, account: Optional[str] = None) -> str:
        """Update the content of an existing note.
        
        Args:
            note_name: Name of the note to update
            new_content: New content for the note
            account: Optional account name where the note is located
        """
        escaped_name = escape_applescript_string(note_name)
        escaped_content = escape_applescript_string(new_content)
        
        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
                    set body of targetNote to "{escaped_content}"
                    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
                        set body of targetNote to "{escaped_content}"
                        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 update note '{note_name}'."
        
        return f"Successfully updated note '{note_name}'."
  • Helper function used by update_note to execute AppleScript commands via subprocess and handle errors/timeouts.
    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
  • Helper function used by update_note to properly escape strings for safe insertion into 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
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It states this is an update operation, implying mutation, but doesn't describe permissions needed, whether changes are reversible, rate limits, or what happens to the note's metadata. This leaves significant gaps for a mutation tool.

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 with a clear purpose statement followed by parameter explanations. The structure is front-loaded with the main functionality. Minor improvement could come from integrating parameter details more seamlessly rather than a separate 'Args:' section.

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 this is a mutation tool with no annotations, 0% schema description coverage, but with an output schema (which reduces need to describe return values), the description is moderately complete. It covers the basic operation and parameters but lacks behavioral context like error conditions or side effects that would be important for safe usage.

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?

The description lists all three parameters with brief explanations, but schema description coverage is 0%, so the schema provides no additional documentation. The description adds basic meaning (e.g., 'Name of the note to update'), but doesn't elaborate on format constraints, character limits, or how 'account' interacts with note location. This meets the baseline for having parameter information but doesn't fully compensate for the schema gap.

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 ('Update') and resource ('content of an existing note'), making the purpose immediately understandable. However, it doesn't explicitly differentiate from sibling tools like 'create_note' or 'read_note' beyond the 'existing note' qualifier, which is why it doesn't reach a perfect score.

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 like 'create_note' or 'read_note'. It mentions 'existing note' which implies a prerequisite, but doesn't explicitly state when to choose this over other tools or any usage constraints.

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