Skip to main content
Glama

compare

Analyze DEVONthink records to identify similarities in content or tags, helping users find related documents and organize information effectively.

Instructions

Compare DEVONthink records for similarities.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
recordUuidYesUUID of the source record to compare
compareWithUuidNoUUID of a second record to compare against; if omitted, returns similar records
databaseNameNoDatabase name (optional, for disambiguation)
comparisonNoComparison mode: 'data comparison' (content-based) or 'tags comparison'

Implementation Reference

  • The `compareTool` handles the "compare" tool functionality, performing either a pairwise comparison or finding similar records in DEVONthink.
    export const compareTool = defineTool({
      name: "compare",
      description: "Compare DEVONthink records for similarities.",
      schema: z.object({
        recordUuid: z
          .string()
          .describe("UUID of the source record to compare"),
        compareWithUuid: z
          .string()
          .optional()
          .describe(
            "UUID of a second record to compare against; if omitted, returns similar records"
          ),
        databaseName: z
          .string()
          .optional()
          .describe("Database name (optional, for disambiguation)"),
        comparison: z
          .enum(COMPARISON_VALUES)
          .optional()
          .describe(
            "Comparison mode: 'data comparison' (content-based) or 'tags comparison'"
          ),
      }),
      run: async (args, executor) => {
        const { recordUuid, compareWithUuid, databaseName, comparison } = args;
    
        const script = `
          ${JXA_APP}
          var uuid = ${jxaLiteral(recordUuid)};
          var compareWithUuid = ${jxaLiteral(compareWithUuid ?? null)};
          var dbName = ${jxaLiteral(databaseName ?? null)};
          var comparison = ${jxaLiteral(comparison ?? null)};
    
          var record = app.getRecordWithUuid(uuid);
          if (!record || !record.uuid()) throw new Error("Record not found for UUID: " + uuid);
    
          var opts = {};
          if (comparison) opts["comparison"] = comparison;
    
          if (compareWithUuid) {
            // Pairwise comparison between two specific records
            var recordB = app.getRecordWithUuid(compareWithUuid);
            if (!recordB || !recordB.uuid()) throw new Error("Comparison record not found for UUID: " + compareWithUuid);
    
            var score = null;
            try {
              // Try compareContent which returns a score
              score = app.compareContent(record, recordB, opts);
            } catch(e) {
              try {
                score = app.compare(record, {to: recordB, comparison: comparison || "data comparison"});
              } catch(e2) {
                score = null;
              }
            }
    
            JSON.stringify({
              recordA: {
                uuid: record.uuid(),
                name: record.name(),
                database: record.database().name()
              },
              recordB: {
                uuid: recordB.uuid(),
                name: recordB.name(),
                database: recordB.database().name()
              },
              score: score,
              comparison: comparison || "data comparison"
            });
    
          } else {
            // Get similar records (See Also)
            var similar = null;
            try {
              similar = app.compare(record, opts);
            } catch(e) {
              try {
                similar = app.seeAlso(record);
              } catch(e2) {
                similar = [];
              }
            }
    
            if (!similar || similar.length === 0) {
              JSON.stringify([]);
            } else {
              var results = similar.map(function(r) {
                try {
                  return {
                    uuid: r.uuid ? r.uuid() : null,
                    name: r.name ? r.name() : null,
                    type: r.type ? r.type() : null,
                    location: r.location ? r.location() : null,
                    database: r.database ? r.database().name() : null,
                    score: r.score ? r.score() : null,
                    modificationDate: r.modificationDate && r.modificationDate()
                      ? r.modificationDate().toISOString()
                      : null
                  };
                } catch(e) {
                  return { raw: String(r) };
                }
              });
              JSON.stringify(results);
            }
          }
        `;
    
        const result = executor.run(script);
        return JSON.parse(result.stdout);
      },
    });
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 but fails to indicate if the operation is read-only, what format results are returned in, or the significance of omitting the compareWithUuid parameter (which triggers a 'find similar' mode rather than a direct comparison).

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

Conciseness3/5

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

The single-sentence description is not verbose, but for a tool with four parameters and dual operating modes, it is undersized. It front-loads the verb and resource, yet the extreme brevity constitutes under-specification rather than efficient conciseness given the tool's complexity.

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?

Given the lack of annotations and output schema, the description should disclose safety properties (read-only status), return value structure, and behavioral nuances. It omits all of these, leaving significant gaps in contextual information needed for proper tool invocation.

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 100%, with all four parameters (recordUuid, compareWithUuid, databaseName, comparison) fully documented in the schema including enum explanations. The description adds no supplementary parameter guidance, meeting the baseline expectation when the schema is self-sufficient.

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

Purpose3/5

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

The description states the basic action (compare records for similarities) and resource (DEVONthink records), but remains vague about the comparison scope. It fails to distinguish from sibling tools like 'search' or 'classify' that also find similar items, and omits the tool's dual behavior (comparing two specific records vs. finding records similar to one).

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 provided on when to use this tool versus alternatives like 'search' or 'ask_ai_about_documents'. The description lacks prerequisites (e.g., needing record UUIDs) and excludes context about when to use 'data comparison' versus 'tags comparison' modes.

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

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