Skip to main content
Glama

classify

Generate classification proposals for DEVONthink records using content-based or tag-based comparison to organize documents effectively.

Instructions

Get classification proposals for a DEVONthink record.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
recordUuidYesUUID of the record to classify
databaseNameNoDatabase name (optional, for disambiguation)
comparisonNoComparison mode: 'data comparison' (content-based) or 'tags comparison'
tagsNoInclude tag-based proposals in the results

Implementation Reference

  • The `classify` tool implementation, including its schema definition and the `run` handler that executes a JXA script to interact with DEVONthink.
    export const classifyTool = defineTool({
      name: "classify",
      description: "Get classification proposals for a DEVONthink record.",
      schema: z.object({
        recordUuid: z.string().describe("UUID of the record to classify"),
        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'"
          ),
        tags: z
          .boolean()
          .optional()
          .describe("Include tag-based proposals in the results"),
      }),
      run: async (args, executor) => {
        const { recordUuid, databaseName, comparison, tags } = args;
    
        const script = `
          ${JXA_APP}
          var uuid = ${jxaLiteral(recordUuid)};
          var dbName = ${jxaLiteral(databaseName ?? null)};
          var comparison = ${jxaLiteral(comparison ?? null)};
          var includeTags = ${jxaLiteral(tags ?? false)};
    
          var record = app.getRecordWithUuid(uuid);
          if (!record || !record.uuid()) throw new Error("Record not found for UUID: " + uuid);
    
          // Build classify options
          var opts = {};
          if (comparison) opts["comparison"] = comparison;
          if (includeTags) opts["tags"] = true;
    
          var proposals;
          try {
            proposals = app.classify(record, opts);
          } catch(e) {
            // Fallback: try without options (older DEVONthink API)
            try {
              proposals = app.classify(record);
            } catch(e2) {
              proposals = [];
            }
          }
    
          if (!proposals || proposals.length === 0) {
            JSON.stringify([]);
          } else {
            var results = proposals.map(function(proposal) {
              try {
                return {
                  uuid: proposal.uuid ? proposal.uuid() : null,
                  name: proposal.name ? proposal.name() : null,
                  location: proposal.location ? proposal.location() : null,
                  database: proposal.database ? proposal.database().name() : null,
                  score: proposal.score ? proposal.score() : null
                };
              } catch(e) {
                return { raw: String(proposal) };
              }
            });
            JSON.stringify(results);
          }
        `;
    
        const result = executor.run(script);
        return JSON.parse(result.stdout);
      },
    });
Behavior3/5

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

Without annotations, the description carries the burden of indicating this is a read-only operation returning suggestions rather than applying classification, which it does with the word 'Get'. However, it fails to describe what the proposals contain (suggested tags? groups?), how many are returned, or behavioral differences between the comparison modes.

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 single sentence is efficient and front-loaded with no redundant words. However, it borders on underspecification given the tool's behavioral complexity (multiple comparison modes, boolean flags) and lack of output schema.

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?

The description covers the core purpose but remains minimal for a 4-parameter tool with distinct operational modes. It does not explain the nature of classification proposals or expected return values, though the input schema is well-documented.

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%, providing detailed descriptions for all four parameters including the enum values for 'comparison'. The description adds no parameter-specific details, but the baseline score of 3 is appropriate given the schema's completeness.

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 action (get classification proposals) and target resource (DEVONthink record). It implicitly distinguishes from sibling write operations like 'add_tags' or 'set_record_properties' by specifying this returns proposals rather than applying changes.

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 'compare', or when to choose between the 'data comparison' and 'tags comparison' modes. No mention of prerequisites (e.g., whether the record must already exist in the database).

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