move_record
Relocate records between groups in DEVONthink databases using UUIDs or identifiers to reorganize content and maintain document organization.
Instructions
Move a record to a different group in DEVONthink. Resolve the source record by uuid (preferred), recordId + databaseName, recordName + databaseName, or recordPath + databaseName. Provide destinationGroupUuid to specify where to move the record. Returns the updated record properties after the move.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| uuid | No | UUID of the record to move | |
| recordId | No | Numeric record ID (requires databaseName) | |
| recordName | No | Record name (requires databaseName, use uuid when possible) | |
| recordPath | No | Record path within the database (requires databaseName) | |
| destinationGroupUuid | No | UUID of the destination group | |
| databaseName | No | Database name (required for recordId, recordName, recordPath) |
Implementation Reference
- src/tools/records/move-record.ts:14-64 (handler)The implementation of the `move_record` tool, defining the input schema and the JXA script executed to move a record in DEVONthink.
export const moveRecordTool = defineTool({ name: "move_record", description: "Move a record to a different group in DEVONthink. " + "Resolve the source record by uuid (preferred), recordId + databaseName, " + "recordName + databaseName, or recordPath + databaseName. " + "Provide destinationGroupUuid to specify where to move the record. " + "Returns the updated record properties after the move.", schema: z.object({ uuid: z.string().optional().describe("UUID of the record to move"), recordId: z.number().int().nonnegative().optional().describe("Numeric record ID (requires databaseName)"), recordName: z.string().optional().describe("Record name (requires databaseName, use uuid when possible)"), recordPath: z.string().optional().describe("Record path within the database (requires databaseName)"), destinationGroupUuid: z.string().optional().describe("UUID of the destination group"), databaseName: z.string().optional().describe("Database name (required for recordId, recordName, recordPath)"), }), run: async (args, executor) => { const { uuid, recordId, recordName, recordPath, destinationGroupUuid, databaseName } = args; const script = ` ${JXA_APP} var uuid = ${jxaLiteral(uuid ?? null)}; var recordId = ${jxaLiteral(recordId ?? null)}; var recordName = ${jxaLiteral(recordName ?? null)}; var recordPath = ${jxaLiteral(recordPath ?? null)}; var dbName = ${jxaLiteral(databaseName ?? null)}; var destinationGroupUuid = ${jxaLiteral(destinationGroupUuid ?? null)}; ${JXA_RESOLVE_DB} ${JXA_RESOLVE_RECORD} var destGroup = null; if (destinationGroupUuid) { destGroup = app.getRecordWithUuid(destinationGroupUuid); if (!destGroup || !destGroup.uuid()) throw new Error("Destination group not found for UUID: " + destinationGroupUuid); } else { destGroup = db.root(); } app.move({record: record, to: destGroup}); var moved = app.getRecordWithUuid(record.uuid()); if (!moved || !moved.uuid()) throw new Error("Move operation failed"); var record = moved; JSON.stringify(${JXA_RECORD_PROPS}); `; const result = executor.run(script); return JSON.parse(result.stdout); }, });