Skip to main content
Glama

duplicate_record

Create independent copies of records in different database groups. Duplicates remain separate from originals — editing one does not affect the other. Specify destination group UUID to place the copy.

Instructions

Duplicate a record to any destination group, creating an independent copy. Unlike replicants, duplicates are completely separate records — editing one does not affect the other. The duplicate can be placed in a different database from the original. Destination group UUID is required. Returns the properties of the newly created duplicate.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
uuidNoUUID of the record to duplicate
recordIdNoNumeric record ID (requires databaseName)
recordPathNoRecord path within the database (requires databaseName)
destinationGroupUuidYesUUID of the destination group for the duplicate
databaseNameNoDatabase name (required for recordId or recordPath lookups)

Implementation Reference

  • The 'run' function handles the logic for duplicating a DEVONthink record by constructing and executing a JXA script.
    run: async (args, executor) => {
      const { uuid, recordId, recordPath, destinationGroupUuid, databaseName } = args;
    
      const script = `
        ${JXA_APP}
        var uuid = ${jxaLiteral(uuid ?? null)};
        var recordId = ${jxaLiteral(recordId ?? null)};
        var recordPath = ${jxaLiteral(recordPath ?? null)};
        var recordName = null;
        var dbName = ${jxaLiteral(databaseName ?? null)};
        var destinationGroupUuid = ${jxaLiteral(destinationGroupUuid)};
    
        ${JXA_RESOLVE_DB}
        ${JXA_RESOLVE_RECORD}
    
        var destGroup = app.getRecordWithUuid(destinationGroupUuid);
        if (!destGroup || !destGroup.uuid()) throw new Error("Destination group not found for UUID: " + destinationGroupUuid);
    
        var duplicate = app.duplicate({record: record, to: destGroup});
        if (!duplicate || !duplicate.uuid()) throw new Error("Duplicate operation failed");
    
        var record = duplicate;
        JSON.stringify(${JXA_RECORD_PROPS});
      `;
    
      const result = executor.run(script);
      return JSON.parse(result.stdout);
    },
  • The Zod schema defines the input parameters for the 'duplicate_record' tool.
    schema: z.object({
      uuid: z.string().optional().describe("UUID of the record to duplicate"),
      recordId: z.number().int().nonnegative().optional().describe("Numeric record ID (requires databaseName)"),
      recordPath: z.string().optional().describe("Record path within the database (requires databaseName)"),
      destinationGroupUuid: z.string().describe("UUID of the destination group for the duplicate"),
      databaseName: z.string().optional().describe("Database name (required for recordId or recordPath lookups)"),
    }),
  • The tool is defined and exported as 'duplicateRecordTool' using the 'defineTool' helper.
    export const duplicateRecordTool = defineTool({
      name: "duplicate_record",
      description:
        "Duplicate a record to any destination group, creating an independent copy. " +
        "Unlike replicants, duplicates are completely separate records — editing one does not affect the other. " +
        "The duplicate can be placed in a different database from the original. " +
        "Destination group UUID is required. " +
        "Returns the properties of the newly created duplicate.",
      schema: z.object({
        uuid: z.string().optional().describe("UUID of the record to duplicate"),
        recordId: z.number().int().nonnegative().optional().describe("Numeric record ID (requires databaseName)"),
        recordPath: z.string().optional().describe("Record path within the database (requires databaseName)"),
        destinationGroupUuid: z.string().describe("UUID of the destination group for the duplicate"),
        databaseName: z.string().optional().describe("Database name (required for recordId or recordPath lookups)"),
      }),
      run: async (args, executor) => {
        const { uuid, recordId, recordPath, destinationGroupUuid, databaseName } = args;
    
        const script = `
          ${JXA_APP}
          var uuid = ${jxaLiteral(uuid ?? null)};
          var recordId = ${jxaLiteral(recordId ?? null)};
          var recordPath = ${jxaLiteral(recordPath ?? null)};
          var recordName = null;
          var dbName = ${jxaLiteral(databaseName ?? null)};
          var destinationGroupUuid = ${jxaLiteral(destinationGroupUuid)};
    
          ${JXA_RESOLVE_DB}
          ${JXA_RESOLVE_RECORD}
    
          var destGroup = app.getRecordWithUuid(destinationGroupUuid);
          if (!destGroup || !destGroup.uuid()) throw new Error("Destination group not found for UUID: " + destinationGroupUuid);
    
          var duplicate = app.duplicate({record: record, to: destGroup});
          if (!duplicate || !duplicate.uuid()) throw new Error("Duplicate operation failed");
    
          var record = duplicate;
          JSON.stringify(${JXA_RECORD_PROPS});
        `;
    
        const result = executor.run(script);
        return JSON.parse(result.stdout);
      },
    });
Behavior4/5

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

No annotations provided, so description carries full burden. Successfully discloses key behaviors: creates independent copy (not linked), supports cross-database placement, and returns properties of new duplicate. Missing: permission requirements or idempotency notes.

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

Conciseness5/5

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

Three sentences, zero waste. Front-loaded with core action, followed by critical distinction from siblings, then capabilities and return value. No redundancy with structured schema data.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Appropriately complete for a 5-parameter mutation tool with no output schema. Compensates by describing return value ('Returns the properties...') and explaining cross-database capability. Minor gap: does not clarify that uuid/recordId/recordPath are alternative identification methods.

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 has 100% description coverage, establishing baseline 3. Description reinforces that 'Destination group UUID is required' (matching schema's required array) but does not add semantic context about mutual exclusivity of uuid vs recordId/recordPath identification methods.

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

Purpose5/5

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

Clear verb-resource combination ('Duplicate a record') with explicit scope ('to any destination group'). Explicitly distinguishes from sibling tool 'replicate_record' by contrasting 'duplicates' with 'replicants' and explaining the independence property.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Provides clear behavioral context to distinguish from 'replicate_record' (editing one does not affect the other). Implicitly guides selection by explaining the independence trait, though could be more explicit with 'Use this when you need independent copies vs. replicants for linked copies.'

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