applescript_context.json•8.03 kB
{
"tool_category": "applescript",
"description": "AppleScript execution context with memory integration for reusable script management",
"auto_convert": true,
"syntax_rules": {
"script_structure": {
"format": "tell_application_blocks",
"examples": {
"basic": "tell application \"AppName\"\n -- commands here\nend tell",
"nested": "tell application \"Finder\"\n tell folder \"Documents\"\n -- commands here\n end tell\nend tell"
}
},
"naming_conventions": {
"variables": "camelCase or underscore_separated",
"handlers": "verbNoun format (e.g., createEvent, sendMessage)",
"properties": "descriptive names"
},
"string_handling": {
"quotes": "use double quotes for literal strings",
"concatenation": "use & operator",
"escape": "use backslash for special characters"
},
"date_format": {
"preferred": "date \"December 25, 2024 2:00 PM\"",
"avoid": "ambiguous formats without explicit parsing"
}
},
"preferences": {
"error_handling": {
"use_try_blocks": true,
"provide_meaningful_errors": true,
"log_errors": true
},
"performance": {
"minimize_tell_blocks": true,
"batch_operations": true,
"avoid_ui_scripting_when_possible": true
},
"compatibility": {
"test_on_target_os_version": true,
"check_app_availability": true,
"handle_missing_apps_gracefully": true
}
},
"memory_integration": {
"workflow": {
"step1": "Search memory for existing scripts: search_by_tag(['applescript', '<app>', '<action>'])",
"step2": "Adapt found scripts or create new ones",
"step3": "Store successful scripts with rich metadata",
"step4": "Tag frequently used scripts as 'high-priority'"
},
"storage_pattern": {
"content": "The AppleScript code with PARAMETER placeholders",
"metadata": {
"tags": [
"applescript",
"app:<name>",
"action:<type>",
"category:<category>"
],
"type": "applescript-template",
"description": "Clear description of functionality",
"parameters": [
"list",
"of",
"replaceable",
"parameters"
],
"example_usage": "How to use this script",
"tested_on": "macOS version",
"dependencies": [
"required apps or permissions"
]
}
},
"tag_taxonomy": {
"app_tags": [
"app:calendar",
"app:finder",
"app:messages",
"app:notes",
"app:mail",
"app:safari",
"app:system"
],
"action_tags": [
"action:create",
"action:read",
"action:update",
"action:delete",
"action:search",
"action:notify"
],
"category_tags": [
"category:productivity",
"category:communication",
"category:system",
"category:file-management"
],
"feature_tags": [
"feature:automation",
"feature:notification",
"feature:integration"
]
}
},
"auto_corrections": {
"parameter_placeholder": {
"pattern": "\\{\\{([A-Z_]+)\\}\\}",
"replacement": "PARAMETER_NAME format for consistency"
},
"date_string_format": {
"pattern": "date \"([0-9]{1,2})/([0-9]{1,2})/([0-9]{4})\"",
"replacement": "date \"$2/$1/$3\" (ensure month/day order)"
},
"app_name_case": {
"pattern": "tell application \"([a-z])([a-z]+)\"",
"replacement": "tell application \"$1$2\" (maintain exact app name case)"
}
},
"common_patterns": {
"calendar_event": {
"template": "tell application \"Calendar\"\n tell calendar \"CALENDAR_NAME\"\n set startDate to date \"START_DATE\"\n set endDate to date \"END_DATE\"\n make new event with properties {summary:\"EVENT_TITLE\", start date:startDate, end date:endDate}\n end tell\nend tell",
"parameters": [
"CALENDAR_NAME",
"EVENT_TITLE",
"START_DATE",
"END_DATE"
]
},
"send_message": {
"template": "tell application \"Messages\"\n set targetBuddy to buddy \"RECIPIENT_ID\" of service \"SERVICE_TYPE\"\n send \"MESSAGE_TEXT\" to targetBuddy\nend tell",
"parameters": [
"RECIPIENT_ID",
"SERVICE_TYPE",
"MESSAGE_TEXT"
]
},
"system_notification": {
"template": "display notification \"NOTIFICATION_MESSAGE\" with title \"NOTIFICATION_TITLE\" sound name \"SOUND_NAME\"",
"parameters": [
"NOTIFICATION_TITLE",
"NOTIFICATION_MESSAGE",
"SOUND_NAME"
]
},
"file_search": {
"template": "tell application \"Finder\"\n set searchFolder to folder \"FOLDER_PATH\"\n set fileList to every file of searchFolder whose name contains \"SEARCH_TERM\"\n return fileList\nend tell",
"parameters": [
"FOLDER_PATH",
"SEARCH_TERM"
]
}
},
"best_practices": {
"security": {
"no_hardcoded_passwords": true,
"validate_file_paths": true,
"check_permissions": true,
"warn_user_about_required_permissions": true
},
"reliability": {
"check_app_running": true,
"handle_missing_elements": true,
"timeout_long_operations": true,
"provide_progress_feedback": true
},
"maintainability": {
"use_clear_variable_names": true,
"comment_complex_logic": true,
"modularize_with_handlers": true,
"version_control_scripts": true
}
},
"permission_requirements": {
"automation": {
"required_for": [
"tell application blocks"
],
"grant_via": "System Preferences > Security & Privacy > Privacy > Automation"
},
"full_disk_access": {
"required_for": [
"Messages history",
"Mail access",
"certain file operations"
],
"grant_via": "System Preferences > Security & Privacy > Privacy > Full Disk Access"
},
"notifications": {
"required_for": [
"display notification"
],
"grant_via": "System Preferences > Notifications > Script Editor"
}
},
"tool_integration": {
"primary_tool": "execute_applescript",
"tool_source": "@peakmojo/applescript-mcp",
"usage_pattern": "Pass complete AppleScript code as string parameter",
"memory_tools": [
"store_memory",
"search_by_tag",
"retrieve_memory",
"recall_memory"
]
},
"metadata": {
"version": "1.0.0",
"last_updated": "2025-09-18T10:44:02.523875",
"applies_to_tools": [
"execute_applescript",
"applescript:*",
"memory:*"
],
"dependencies": [
"mcp-memory-service"
],
"author": "MCP Context Provider"
},
"auto_store_triggers": {
"applescript_code_detection": {
"tags": [
"applescript",
"automation"
],
"action": "store_with_metadata",
"patterns": [
"tell application",
"end tell",
"osascript",
"AppleScript",
"display notification",
"set .* to .*"
],
"confidence_threshold": 0.7
}
},
"auto_retrieve_triggers": {
"applescript_help_request": {
"action": "search_and_suggest",
"patterns": [
"how do I .* in applescript",
"applescript .* example",
"script to .*",
"automate .*"
],
"search_tags": [
"applescript"
],
"confidence_threshold": 0.6
}
},
"session_initialization": {
"enabled": true,
"actions": {
"on_startup": [
{
"action": "search_memory",
"store_as": "recent_applescripts",
"parameters": {
"tags": [
"applescript"
],
"n_results": 5
}
},
{
"action": "notify",
"message": "AppleScript context loaded. Found {recent_applescripts.count} stored scripts."
}
]
}
}
}