Skip to main content
Glama

list_smart_rules

Enumerate DEVONthink smart rules by parsing SmartRules.plist to retrieve names, UUIDs, enabled states, and execution timestamps when standard APIs are unavailable.

Instructions

List all DEVONthink smart rules by parsing SmartRules.plist. Returns name, UUID (from sync.UUID), enabled state, indexOffset, lastExecution timestamp, and sync date for each rule. Smart rules are NOT accessible via the standard AppleScript API — this is the only way to enumerate them.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function 'listSmartRules' that parses the DEVONthink SmartRules.plist file and returns the list of smart rules.
    const listSmartRules = async (): Promise<SmartRulesResult> => {
      if (!existsSync(PLIST_PATH)) {
        return {
          success: false,
          error: `SmartRules.plist not found at: ${PLIST_PATH}. Ensure DEVONthink has been run at least once and smart rules have been created.`,
        };
      }
    
      let xml: string;
      try {
        xml = execSync(`plutil -convert xml1 -o - "${PLIST_PATH}"`, {
          encoding: "utf-8",
          timeout: 10000,
        });
      } catch (err) {
        return {
          success: false,
          error: `Failed to parse SmartRules.plist: ${err instanceof Error ? err.message : String(err)}`,
        };
      }
    
      let smartRules: SmartRuleEntry[];
      try {
        smartRules = parsePlistXmlToSmartRules(xml);
      } catch (err) {
        return {
          success: false,
          error: `Failed to parse XML output from plutil: ${err instanceof Error ? err.message : String(err)}`,
        };
      }
    
      smartRules.sort((a, b) => a.name.localeCompare(b.name));
    
      return { success: true, smartRules, totalCount: smartRules.length };
    };
  • The MCP tool object 'listSmartRulesTool' which registers the 'list_smart_rules' name and associates it with the 'listSmartRules' handler.
    export const listSmartRulesTool: McpTool = {
      name: "list_smart_rules",
      description:
        "List all DEVONthink smart rules by parsing SmartRules.plist. " +
        "Returns name, UUID (from sync.UUID), enabled state, indexOffset, lastExecution timestamp, " +
        "and sync date for each rule. " +
        "Smart rules are NOT accessible via the standard AppleScript API — this is the only way to enumerate them.",
      inputSchema: {
        type: "object" as const,
        properties: {},
        additionalProperties: false,
      },
      run: listSmartRules,
    };

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/mnott/Devon'

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