Skip to main content
Glama

replicate_record

Create a copy of a database record in a destination group. Replicants share data — editing one affects all copies. Specify source by UUID, record ID, or path.

Instructions

Replicate a record within the same database to a destination group. Replicants share the same underlying data — editing one affects all replicants. Destination group UUID is required. Resolve the source record by uuid (preferred), recordId + databaseName, or recordPath + databaseName. Returns the properties of the new replicant.

Input Schema

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

Implementation Reference

  • The 'run' function handles the execution of the JXA script to replicate a DEVONthink record.
    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 replicant = app.replicate({record: record, to: destGroup});
        if (!replicant || !replicant.uuid()) throw new Error("Replicate operation failed");
    
        var record = replicant;
        JSON.stringify(${JXA_RECORD_PROPS});
      `;
    
      const result = executor.run(script);
      return JSON.parse(result.stdout);
    },
  • Input schema for the 'replicate_record' tool.
    schema: z.object({
      uuid: z.string().optional().describe("UUID of the record to replicate"),
      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 replicant"),
      databaseName: z.string().optional().describe("Database name (required for recordId or recordPath lookups)"),
    }),
  • Tool registration for 'replicate_record'.
    export const replicateRecordTool = defineTool({
      name: "replicate_record",

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