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
| Name | Required | Description | Default |
|---|---|---|---|
| uuid | No | UUID of the record to replicate | |
| recordId | No | Numeric record ID (requires databaseName) | |
| recordPath | No | Record path within the database (requires databaseName) | |
| destinationGroupUuid | Yes | UUID of the destination group for the replicant | |
| databaseName | No | Database 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)"), }), - src/tools/records/replicate-record.ts:14-15 (registration)Tool registration for 'replicate_record'.
export const replicateRecordTool = defineTool({ name: "replicate_record",