@tekmidian/devon 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +472 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +82 -0
- package/dist/index.js.map +1 -0
- package/dist/jxa/escape.d.ts +22 -0
- package/dist/jxa/escape.js +38 -0
- package/dist/jxa/escape.js.map +1 -0
- package/dist/jxa/executor.d.ts +32 -0
- package/dist/jxa/executor.js +65 -0
- package/dist/jxa/executor.js.map +1 -0
- package/dist/jxa/helpers.d.ts +51 -0
- package/dist/jxa/helpers.js +136 -0
- package/dist/jxa/helpers.js.map +1 -0
- package/dist/jxa/types.d.ts +33 -0
- package/dist/jxa/types.js +43 -0
- package/dist/jxa/types.js.map +1 -0
- package/dist/server.d.ts +10 -0
- package/dist/server.js +65 -0
- package/dist/server.js.map +1 -0
- package/dist/setup.d.ts +12 -0
- package/dist/setup.js +323 -0
- package/dist/setup.js.map +1 -0
- package/dist/shared/plist/parser.d.ts +29 -0
- package/dist/shared/plist/parser.js +112 -0
- package/dist/shared/plist/parser.js.map +1 -0
- package/dist/shared/plist/reader.d.ts +31 -0
- package/dist/shared/plist/reader.js +127 -0
- package/dist/shared/plist/reader.js.map +1 -0
- package/dist/shared/shell.d.ts +15 -0
- package/dist/shared/shell.js +22 -0
- package/dist/shared/shell.js.map +1 -0
- package/dist/tools/ai/ask-ai-about-documents.d.ts +8 -0
- package/dist/tools/ai/ask-ai-about-documents.js +88 -0
- package/dist/tools/ai/ask-ai-about-documents.js.map +1 -0
- package/dist/tools/ai/check-ai-health.d.ts +8 -0
- package/dist/tools/ai/check-ai-health.js +40 -0
- package/dist/tools/ai/check-ai-health.js.map +1 -0
- package/dist/tools/ai/create-summary-document.d.ts +8 -0
- package/dist/tools/ai/create-summary-document.js +102 -0
- package/dist/tools/ai/create-summary-document.js.map +1 -0
- package/dist/tools/ai/get-ai-tool-documentation.d.ts +8 -0
- package/dist/tools/ai/get-ai-tool-documentation.js +220 -0
- package/dist/tools/ai/get-ai-tool-documentation.js.map +1 -0
- package/dist/tools/application/is-running.d.ts +7 -0
- package/dist/tools/application/is-running.js +24 -0
- package/dist/tools/application/is-running.js.map +1 -0
- package/dist/tools/custom/column-layout.d.ts +9 -0
- package/dist/tools/custom/column-layout.js +244 -0
- package/dist/tools/custom/column-layout.js.map +1 -0
- package/dist/tools/custom/list-smart-groups.d.ts +8 -0
- package/dist/tools/custom/list-smart-groups.js +79 -0
- package/dist/tools/custom/list-smart-groups.js.map +1 -0
- package/dist/tools/custom/list-smart-rules.d.ts +8 -0
- package/dist/tools/custom/list-smart-rules.js +85 -0
- package/dist/tools/custom/list-smart-rules.js.map +1 -0
- package/dist/tools/custom/parse-eml-headers.d.ts +8 -0
- package/dist/tools/custom/parse-eml-headers.js +155 -0
- package/dist/tools/custom/parse-eml-headers.js.map +1 -0
- package/dist/tools/database/get-current-database.d.ts +7 -0
- package/dist/tools/database/get-current-database.js +29 -0
- package/dist/tools/database/get-current-database.js.map +1 -0
- package/dist/tools/database/get-open-databases.d.ts +6 -0
- package/dist/tools/database/get-open-databases.js +32 -0
- package/dist/tools/database/get-open-databases.js.map +1 -0
- package/dist/tools/groups/get-selected-records.d.ts +8 -0
- package/dist/tools/groups/get-selected-records.js +30 -0
- package/dist/tools/groups/get-selected-records.js.map +1 -0
- package/dist/tools/groups/list-group-content.d.ts +8 -0
- package/dist/tools/groups/list-group-content.js +65 -0
- package/dist/tools/groups/list-group-content.js.map +1 -0
- package/dist/tools/index.d.ts +9 -0
- package/dist/tools/index.js +87 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/intelligence/classify.d.ts +8 -0
- package/dist/tools/intelligence/classify.js +83 -0
- package/dist/tools/intelligence/classify.js.map +1 -0
- package/dist/tools/intelligence/compare.d.ts +8 -0
- package/dist/tools/intelligence/compare.js +121 -0
- package/dist/tools/intelligence/compare.js.map +1 -0
- package/dist/tools/records/convert-record.d.ts +10 -0
- package/dist/tools/records/convert-record.js +77 -0
- package/dist/tools/records/convert-record.js.map +1 -0
- package/dist/tools/records/create-record.d.ts +8 -0
- package/dist/tools/records/create-record.js +64 -0
- package/dist/tools/records/create-record.js.map +1 -0
- package/dist/tools/records/delete-record.d.ts +9 -0
- package/dist/tools/records/delete-record.js +50 -0
- package/dist/tools/records/delete-record.js.map +1 -0
- package/dist/tools/records/duplicate-record.d.ts +8 -0
- package/dist/tools/records/duplicate-record.js +53 -0
- package/dist/tools/records/duplicate-record.js.map +1 -0
- package/dist/tools/records/get-record-by-id.d.ts +8 -0
- package/dist/tools/records/get-record-by-id.js +51 -0
- package/dist/tools/records/get-record-by-id.js.map +1 -0
- package/dist/tools/records/get-record-content.d.ts +7 -0
- package/dist/tools/records/get-record-content.js +48 -0
- package/dist/tools/records/get-record-content.js.map +1 -0
- package/dist/tools/records/get-record-properties.d.ts +7 -0
- package/dist/tools/records/get-record-properties.js +42 -0
- package/dist/tools/records/get-record-properties.js.map +1 -0
- package/dist/tools/records/move-record.d.ts +8 -0
- package/dist/tools/records/move-record.js +60 -0
- package/dist/tools/records/move-record.js.map +1 -0
- package/dist/tools/records/rename-record.d.ts +7 -0
- package/dist/tools/records/rename-record.js +40 -0
- package/dist/tools/records/rename-record.js.map +1 -0
- package/dist/tools/records/replicate-record.d.ts +8 -0
- package/dist/tools/records/replicate-record.js +53 -0
- package/dist/tools/records/replicate-record.js.map +1 -0
- package/dist/tools/records/set-record-properties.d.ts +10 -0
- package/dist/tools/records/set-record-properties.js +76 -0
- package/dist/tools/records/set-record-properties.js.map +1 -0
- package/dist/tools/records/update-record-content.d.ts +7 -0
- package/dist/tools/records/update-record-content.js +43 -0
- package/dist/tools/records/update-record-content.js.map +1 -0
- package/dist/tools/search/lookup-record.d.ts +7 -0
- package/dist/tools/search/lookup-record.js +160 -0
- package/dist/tools/search/lookup-record.js.map +1 -0
- package/dist/tools/search/search.d.ts +8 -0
- package/dist/tools/search/search.js +146 -0
- package/dist/tools/search/search.js.map +1 -0
- package/dist/tools/tags/add-tags.d.ts +7 -0
- package/dist/tools/tags/add-tags.js +47 -0
- package/dist/tools/tags/add-tags.js.map +1 -0
- package/dist/tools/tags/remove-tags.d.ts +7 -0
- package/dist/tools/tags/remove-tags.js +53 -0
- package/dist/tools/tags/remove-tags.js.map +1 -0
- package/dist/tools/web/create-from-url.d.ts +8 -0
- package/dist/tools/web/create-from-url.js +140 -0
- package/dist/tools/web/create-from-url.js.map +1 -0
- package/package.json +48 -0
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* create-record.ts — Create a new record in DEVONthink.
|
|
3
|
+
*
|
|
4
|
+
* Creates a record in the specified database and parent group.
|
|
5
|
+
* If parentGroupUuid is provided, the record is created inside that group.
|
|
6
|
+
* If no parentGroupUuid, the record is created in the root of the database.
|
|
7
|
+
*/
|
|
8
|
+
import { z } from "zod";
|
|
9
|
+
import { defineTool } from "../../jxa/types.js";
|
|
10
|
+
import { jxaLiteral } from "../../jxa/escape.js";
|
|
11
|
+
import { JXA_APP, JXA_RESOLVE_DB, JXA_RECORD_PROPS } from "../../jxa/helpers.js";
|
|
12
|
+
export const createRecordTool = defineTool({
|
|
13
|
+
name: "create_record",
|
|
14
|
+
description: "Create a new record in DEVONthink. " +
|
|
15
|
+
"Specify name and type (e.g. 'markdown', 'txt', 'rtf', 'html', 'bookmark', 'group'). " +
|
|
16
|
+
"Optionally provide content, url, a parent group UUID, and database name. " +
|
|
17
|
+
"Returns the full properties of the newly created record.",
|
|
18
|
+
schema: z.object({
|
|
19
|
+
name: z.string().describe("Name for the new record"),
|
|
20
|
+
type: z.string().describe("Record type: 'markdown', 'txt', 'rtf', 'html', 'bookmark', 'group', etc."),
|
|
21
|
+
content: z.string().optional().describe("Initial text content for the record"),
|
|
22
|
+
url: z.string().optional().describe("URL for bookmark records or to associate with the record"),
|
|
23
|
+
parentGroupUuid: z.string().optional().describe("UUID of the parent group (defaults to database root)"),
|
|
24
|
+
databaseName: z.string().optional().describe("Target database name (defaults to current database)"),
|
|
25
|
+
}),
|
|
26
|
+
run: async (args, executor) => {
|
|
27
|
+
const { name, type, content, url, parentGroupUuid, databaseName } = args;
|
|
28
|
+
const script = `
|
|
29
|
+
${JXA_APP}
|
|
30
|
+
var dbName = ${jxaLiteral(databaseName ?? null)};
|
|
31
|
+
var parentGroupUuid = ${jxaLiteral(parentGroupUuid ?? null)};
|
|
32
|
+
|
|
33
|
+
${JXA_RESOLVE_DB}
|
|
34
|
+
|
|
35
|
+
var props = {
|
|
36
|
+
name: ${jxaLiteral(name)},
|
|
37
|
+
type: ${jxaLiteral(type)}
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
var contentVal = ${jxaLiteral(content ?? null)};
|
|
41
|
+
if (contentVal !== null) props.content = contentVal;
|
|
42
|
+
|
|
43
|
+
var urlVal = ${jxaLiteral(url ?? null)};
|
|
44
|
+
if (urlVal !== null) props.URL = urlVal;
|
|
45
|
+
|
|
46
|
+
var location;
|
|
47
|
+
if (parentGroupUuid) {
|
|
48
|
+
var parentGroup = app.getRecordWithUuid(parentGroupUuid);
|
|
49
|
+
if (!parentGroup || !parentGroup.uuid()) throw new Error("Parent group not found for UUID: " + parentGroupUuid);
|
|
50
|
+
location = {in: parentGroup};
|
|
51
|
+
} else {
|
|
52
|
+
location = {in: db};
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
var record = app.createRecordWith(props, location);
|
|
56
|
+
if (!record || !record.uuid()) throw new Error("Failed to create record");
|
|
57
|
+
|
|
58
|
+
JSON.stringify(${JXA_RECORD_PROPS});
|
|
59
|
+
`;
|
|
60
|
+
const result = executor.run(script);
|
|
61
|
+
return JSON.parse(result.stdout);
|
|
62
|
+
},
|
|
63
|
+
});
|
|
64
|
+
//# sourceMappingURL=create-record.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-record.js","sourceRoot":"","sources":["../../../src/tools/records/create-record.ts"],"names":[],"mappings":"AA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AAU,CAAC,eAAe,IAAI,IAAI,CAAC;;QAEzD,cAAc;;;gBAGN,UAAU,CAAC,IAAI,CAAC;gBAChB,UAAU,CAAC,IAAI,CAAC;;;yBAGP,UAAU,CAAC,OAAO,IAAI,IAAI,CAAC;;;qBAG/B,UAAU,CAAC,GAAG,IAAI,IAAI,CAAC;;;;;;;;;;;;;;;uBAerB,gBAAgB;KAClC,CAAC;QAEF,MAAM,MAAM,GAAG,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QACpC,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IACnC,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* delete-record.ts — Delete a record from DEVONthink.
|
|
3
|
+
*
|
|
4
|
+
* Resolves a record by uuid, recordId, or recordPath, then deletes it.
|
|
5
|
+
* Returns confirmation with the uuid and name of the deleted record.
|
|
6
|
+
*
|
|
7
|
+
* WARNING: This operation is permanent and cannot be undone via the MCP API.
|
|
8
|
+
*/
|
|
9
|
+
export declare const deleteRecordTool: import("../../jxa/types.js").McpTool;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* delete-record.ts — Delete a record from DEVONthink.
|
|
3
|
+
*
|
|
4
|
+
* Resolves a record by uuid, recordId, or recordPath, then deletes it.
|
|
5
|
+
* Returns confirmation with the uuid and name of the deleted record.
|
|
6
|
+
*
|
|
7
|
+
* WARNING: This operation is permanent and cannot be undone via the MCP API.
|
|
8
|
+
*/
|
|
9
|
+
import { z } from "zod";
|
|
10
|
+
import { defineTool } from "../../jxa/types.js";
|
|
11
|
+
import { jxaLiteral } from "../../jxa/escape.js";
|
|
12
|
+
import { JXA_APP, JXA_RESOLVE_DB, JXA_RESOLVE_RECORD } from "../../jxa/helpers.js";
|
|
13
|
+
export const deleteRecordTool = defineTool({
|
|
14
|
+
name: "delete_record",
|
|
15
|
+
description: "Delete a record from DEVONthink. " +
|
|
16
|
+
"This operation is permanent — the record is moved to Trash or permanently deleted. " +
|
|
17
|
+
"Provide uuid (preferred), recordId + databaseName, or recordPath + databaseName. " +
|
|
18
|
+
"Returns the uuid and name of the deleted record for confirmation.",
|
|
19
|
+
schema: z.object({
|
|
20
|
+
uuid: z.string().optional().describe("UUID of the record to delete"),
|
|
21
|
+
recordId: z.number().int().nonnegative().optional().describe("Numeric record ID (requires databaseName)"),
|
|
22
|
+
recordPath: z.string().optional().describe("Record path within the database (requires databaseName)"),
|
|
23
|
+
databaseName: z.string().optional().describe("Database name (required for recordId or recordPath lookups)"),
|
|
24
|
+
}),
|
|
25
|
+
run: async (args, executor) => {
|
|
26
|
+
const { uuid, recordId, recordPath, databaseName } = args;
|
|
27
|
+
const script = `
|
|
28
|
+
${JXA_APP}
|
|
29
|
+
var uuid = ${jxaLiteral(uuid ?? null)};
|
|
30
|
+
var recordId = ${jxaLiteral(recordId ?? null)};
|
|
31
|
+
var recordPath = ${jxaLiteral(recordPath ?? null)};
|
|
32
|
+
var recordName = null;
|
|
33
|
+
var dbName = ${jxaLiteral(databaseName ?? null)};
|
|
34
|
+
|
|
35
|
+
${JXA_RESOLVE_DB}
|
|
36
|
+
${JXA_RESOLVE_RECORD}
|
|
37
|
+
|
|
38
|
+
var deletedUuid = record.uuid();
|
|
39
|
+
var deletedName = record.name();
|
|
40
|
+
|
|
41
|
+
try { app.deleteRecord(record); }
|
|
42
|
+
catch(e) { app.delete({record: record}); }
|
|
43
|
+
|
|
44
|
+
JSON.stringify({ deleted: true, uuid: deletedUuid, name: deletedName });
|
|
45
|
+
`;
|
|
46
|
+
const result = executor.run(script);
|
|
47
|
+
return JSON.parse(result.stdout);
|
|
48
|
+
},
|
|
49
|
+
});
|
|
50
|
+
//# sourceMappingURL=delete-record.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delete-record.js","sourceRoot":"","sources":["../../../src/tools/records/delete-record.ts"],"names":[],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7C,cAAc;QACd,kBAAkB;;;;;;;;;KASrB,CAAC;QAEF,MAAM,MAAM,GAAG,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QACpC,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IACnC,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* duplicate-record.ts — Duplicate a DEVONthink record to any destination group.
|
|
3
|
+
*
|
|
4
|
+
* Creates an independent copy (unlike replicants, duplicates are separate records).
|
|
5
|
+
* The duplicate can be in a different database from the original.
|
|
6
|
+
* Uses app.duplicate({record: record, to: destGroup}).
|
|
7
|
+
*/
|
|
8
|
+
export declare const duplicateRecordTool: import("../../jxa/types.js").McpTool;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* duplicate-record.ts — Duplicate a DEVONthink record to any destination group.
|
|
3
|
+
*
|
|
4
|
+
* Creates an independent copy (unlike replicants, duplicates are separate records).
|
|
5
|
+
* The duplicate can be in a different database from the original.
|
|
6
|
+
* Uses app.duplicate({record: record, to: destGroup}).
|
|
7
|
+
*/
|
|
8
|
+
import { z } from "zod";
|
|
9
|
+
import { defineTool } from "../../jxa/types.js";
|
|
10
|
+
import { jxaLiteral } from "../../jxa/escape.js";
|
|
11
|
+
import { JXA_APP, JXA_RESOLVE_DB, JXA_RESOLVE_RECORD, JXA_RECORD_PROPS } from "../../jxa/helpers.js";
|
|
12
|
+
export const duplicateRecordTool = defineTool({
|
|
13
|
+
name: "duplicate_record",
|
|
14
|
+
description: "Duplicate a record to any destination group, creating an independent copy. " +
|
|
15
|
+
"Unlike replicants, duplicates are completely separate records — editing one does not affect the other. " +
|
|
16
|
+
"The duplicate can be placed in a different database from the original. " +
|
|
17
|
+
"Destination group UUID is required. " +
|
|
18
|
+
"Returns the properties of the newly created duplicate.",
|
|
19
|
+
schema: z.object({
|
|
20
|
+
uuid: z.string().optional().describe("UUID of the record to duplicate"),
|
|
21
|
+
recordId: z.number().int().nonnegative().optional().describe("Numeric record ID (requires databaseName)"),
|
|
22
|
+
recordPath: z.string().optional().describe("Record path within the database (requires databaseName)"),
|
|
23
|
+
destinationGroupUuid: z.string().describe("UUID of the destination group for the duplicate"),
|
|
24
|
+
databaseName: z.string().optional().describe("Database name (required for recordId or recordPath lookups)"),
|
|
25
|
+
}),
|
|
26
|
+
run: async (args, executor) => {
|
|
27
|
+
const { uuid, recordId, recordPath, destinationGroupUuid, databaseName } = args;
|
|
28
|
+
const script = `
|
|
29
|
+
${JXA_APP}
|
|
30
|
+
var uuid = ${jxaLiteral(uuid ?? null)};
|
|
31
|
+
var recordId = ${jxaLiteral(recordId ?? null)};
|
|
32
|
+
var recordPath = ${jxaLiteral(recordPath ?? null)};
|
|
33
|
+
var recordName = null;
|
|
34
|
+
var dbName = ${jxaLiteral(databaseName ?? null)};
|
|
35
|
+
var destinationGroupUuid = ${jxaLiteral(destinationGroupUuid)};
|
|
36
|
+
|
|
37
|
+
${JXA_RESOLVE_DB}
|
|
38
|
+
${JXA_RESOLVE_RECORD}
|
|
39
|
+
|
|
40
|
+
var destGroup = app.getRecordWithUuid(destinationGroupUuid);
|
|
41
|
+
if (!destGroup || !destGroup.uuid()) throw new Error("Destination group not found for UUID: " + destinationGroupUuid);
|
|
42
|
+
|
|
43
|
+
var duplicate = app.duplicate({record: record, to: destGroup});
|
|
44
|
+
if (!duplicate || !duplicate.uuid()) throw new Error("Duplicate operation failed");
|
|
45
|
+
|
|
46
|
+
var record = duplicate;
|
|
47
|
+
JSON.stringify(${JXA_RECORD_PROPS});
|
|
48
|
+
`;
|
|
49
|
+
const result = executor.run(script);
|
|
50
|
+
return JSON.parse(result.stdout);
|
|
51
|
+
},
|
|
52
|
+
});
|
|
53
|
+
//# sourceMappingURL=duplicate-record.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"duplicate-record.js","sourceRoot":"","sources":["../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IAAI,IAAI,CAAC;uBACpB,UAAU,CAAC,QAAQ,IAAI,IAAI,CAAC;yBAC1B,UAAU,CAAC,UAAU,IAAI,IAAI,CAAC;;qBAElC,UAAU,CAAC,YAAY,IAAI,IAAI,CAAC;mCAClB,UAAU,CAAC,oBAAoB,CAAC;;QAE3D,cAAc;QACd,kBAAkB;;;;;;;;;uBASH,gBAAgB;KAClC,CAAC;QAEF,MAAM,MAAM,GAAG,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QACpC,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IACnC,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* get-record-by-id.ts — Get a DEVONthink record using its UUID or numeric ID.
|
|
3
|
+
*
|
|
4
|
+
* Supports two lookup modes:
|
|
5
|
+
* - UUID: app.getRecordWithUuid() — works across all open databases
|
|
6
|
+
* - Numeric ID: db.getRecordAt(id) — requires databaseName
|
|
7
|
+
*/
|
|
8
|
+
export declare const getRecordByIdTool: import("../../jxa/types.js").McpTool;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* get-record-by-id.ts — Get a DEVONthink record using its UUID or numeric ID.
|
|
3
|
+
*
|
|
4
|
+
* Supports two lookup modes:
|
|
5
|
+
* - UUID: app.getRecordWithUuid() — works across all open databases
|
|
6
|
+
* - Numeric ID: db.getRecordAt(id) — requires databaseName
|
|
7
|
+
*/
|
|
8
|
+
import { z } from "zod";
|
|
9
|
+
import { defineTool } from "../../jxa/types.js";
|
|
10
|
+
import { jxaLiteral } from "../../jxa/escape.js";
|
|
11
|
+
import { JXA_APP, JXA_RESOLVE_DB, JXA_RECORD_PROPS } from "../../jxa/helpers.js";
|
|
12
|
+
export const getRecordByIdTool = defineTool({
|
|
13
|
+
name: "get_record_by_identifier",
|
|
14
|
+
description: "Get a DEVONthink record using its UUID or ID. " +
|
|
15
|
+
"UUID lookup works across all open databases. " +
|
|
16
|
+
"Numeric ID lookup requires databaseName to be specified.",
|
|
17
|
+
schema: z.object({
|
|
18
|
+
uuid: z.string().optional().describe("UUID of the record (preferred — works across all databases)"),
|
|
19
|
+
id: z.number().int().nonnegative().optional().describe("Numeric record ID (requires databaseName)"),
|
|
20
|
+
databaseName: z.string().optional().describe("Database name (required when using numeric id)"),
|
|
21
|
+
}),
|
|
22
|
+
run: async (args, executor) => {
|
|
23
|
+
const { uuid, id, databaseName } = args;
|
|
24
|
+
if (!uuid && id === undefined) {
|
|
25
|
+
return { error: "Either uuid or id must be provided" };
|
|
26
|
+
}
|
|
27
|
+
const script = `
|
|
28
|
+
${JXA_APP}
|
|
29
|
+
var uuid = ${jxaLiteral(uuid ?? null)};
|
|
30
|
+
var recordId = ${jxaLiteral(id ?? null)};
|
|
31
|
+
var dbName = ${jxaLiteral(databaseName ?? null)};
|
|
32
|
+
|
|
33
|
+
${JXA_RESOLVE_DB}
|
|
34
|
+
|
|
35
|
+
var record;
|
|
36
|
+
if (uuid) {
|
|
37
|
+
record = app.getRecordWithUuid(uuid);
|
|
38
|
+
if (!record || !record.uuid()) throw new Error("Record not found for UUID: " + uuid);
|
|
39
|
+
} else {
|
|
40
|
+
if (!db) throw new Error("databaseName is required when using numeric id");
|
|
41
|
+
record = db.getRecordAt(recordId);
|
|
42
|
+
if (!record || !record.uuid()) throw new Error("Record not found for ID: " + recordId);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
JSON.stringify(${JXA_RECORD_PROPS});
|
|
46
|
+
`;
|
|
47
|
+
const result = executor.run(script);
|
|
48
|
+
return JSON.parse(result.stdout);
|
|
49
|
+
},
|
|
50
|
+
});
|
|
51
|
+
//# sourceMappingURL=get-record-by-id.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-record-by-id.js","sourceRoot":"","sources":["../../../src/tools/records/get-record-by-id.ts"],"names":[],"mappings":"AAAA;;;;;;GA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M,GAAG,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QACpC,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IACnC,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* get-record-content.ts — Get the text content of a DEVONthink record.
|
|
3
|
+
*
|
|
4
|
+
* Retrieves plain text (via plainText()) for text-based records, or falls back
|
|
5
|
+
* to source() for HTML/Markdown records. Binary records (PDF, images) return null.
|
|
6
|
+
*/
|
|
7
|
+
export declare const getRecordContentTool: import("../../jxa/types.js").McpTool;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* get-record-content.ts — Get the text content of a DEVONthink record.
|
|
3
|
+
*
|
|
4
|
+
* Retrieves plain text (via plainText()) for text-based records, or falls back
|
|
5
|
+
* to source() for HTML/Markdown records. Binary records (PDF, images) return null.
|
|
6
|
+
*/
|
|
7
|
+
import { z } from "zod";
|
|
8
|
+
import { defineTool } from "../../jxa/types.js";
|
|
9
|
+
import { jxaLiteral } from "../../jxa/escape.js";
|
|
10
|
+
import { JXA_APP } from "../../jxa/helpers.js";
|
|
11
|
+
export const getRecordContentTool = defineTool({
|
|
12
|
+
name: "get_record_content",
|
|
13
|
+
description: "Gets the content of a specific record in DEVONthink. " +
|
|
14
|
+
"Returns plain text for text-based records, or HTML source for web/HTML records. " +
|
|
15
|
+
"Binary records (PDF, images) return null for content. " +
|
|
16
|
+
"UUID is required; databaseName is optional.",
|
|
17
|
+
schema: z.object({
|
|
18
|
+
uuid: z.string().describe("UUID of the record whose content to retrieve"),
|
|
19
|
+
databaseName: z.string().optional().describe("Database name (optional, for disambiguation)"),
|
|
20
|
+
}),
|
|
21
|
+
run: async (args, executor) => {
|
|
22
|
+
const { uuid, databaseName } = args;
|
|
23
|
+
const script = `
|
|
24
|
+
${JXA_APP}
|
|
25
|
+
var uuid = ${jxaLiteral(uuid)};
|
|
26
|
+
var dbName = ${jxaLiteral(databaseName ?? null)};
|
|
27
|
+
|
|
28
|
+
var record = app.getRecordWithUuid(uuid);
|
|
29
|
+
if (!record || !record.uuid()) throw new Error("Record not found for UUID: " + uuid);
|
|
30
|
+
|
|
31
|
+
var content = null;
|
|
32
|
+
try { content = record.plainText(); } catch(e) {}
|
|
33
|
+
if (!content) {
|
|
34
|
+
try { content = record.source(); } catch(e) {}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
JSON.stringify({
|
|
38
|
+
uuid: record.uuid(),
|
|
39
|
+
name: record.name(),
|
|
40
|
+
type: record.type(),
|
|
41
|
+
content: content || null
|
|
42
|
+
});
|
|
43
|
+
`;
|
|
44
|
+
const result = executor.run(script);
|
|
45
|
+
return JSON.parse(result.stdout);
|
|
46
|
+
},
|
|
47
|
+
});
|
|
48
|
+
//# sourceMappingURL=get-record-content.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-record-content.js","sourceRoot":"","sources":["../../../src/tools/records/get-record-content.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAE/C,MAAM,CAAC,MAAM,oBAAoB,GAAG,UAAU,CAAC;IAC7C,IAAI,EAAE,oBAAoB;IAC1B,WAAW,EACT,uDAAuD;QACvD,kFAAkF;QAClF,wDAAwD;QACxD,6CAA6C;IAC/C,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC;QACf,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,8CAA8C,CAAC;QACzE,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,8CAA8C,CAAC;KAC7F,CAAC;IACF,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE;QAC5B,MAAM,EAAE,IAAI,EAAE,YAAY,EAAE,GAAG,IAAI,CAAC;QAEpC,MAAM,MAAM,GAAG;QACX,OAAO;mBACI,UAAU,CAAC,IAAI,CAAC;qBACd,UAAU,CAAC,YAAY,IAAI,IAAI,CAAC;;;;;;;;;;;;;;;;;KAiBhD,CAAC;QAEF,MAAM,MAAM,GAAG,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QACpC,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IACnC,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* get-record-properties.ts — Get detailed properties and metadata for a DEVONthink record.
|
|
3
|
+
*
|
|
4
|
+
* Resolves a record via uuid, recordId, or recordPath, then returns the full
|
|
5
|
+
* set of standard record properties using the JXA_RECORD_PROPS helper.
|
|
6
|
+
*/
|
|
7
|
+
export declare const getRecordPropertiesTool: import("../../jxa/types.js").McpTool;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* get-record-properties.ts — Get detailed properties and metadata for a DEVONthink record.
|
|
3
|
+
*
|
|
4
|
+
* Resolves a record via uuid, recordId, or recordPath, then returns the full
|
|
5
|
+
* set of standard record properties using the JXA_RECORD_PROPS helper.
|
|
6
|
+
*/
|
|
7
|
+
import { z } from "zod";
|
|
8
|
+
import { defineTool } from "../../jxa/types.js";
|
|
9
|
+
import { jxaLiteral } from "../../jxa/escape.js";
|
|
10
|
+
import { JXA_APP, JXA_RESOLVE_DB, JXA_RESOLVE_RECORD, JXA_RECORD_PROPS } from "../../jxa/helpers.js";
|
|
11
|
+
export const getRecordPropertiesTool = defineTool({
|
|
12
|
+
name: "get_record_properties",
|
|
13
|
+
description: "Get detailed properties and metadata for a DEVONthink record. " +
|
|
14
|
+
"Returns uuid, name, type, path, location, database, size, dates, tags, " +
|
|
15
|
+
"comment, url, kind, mimeType, flagged, locking, wordCount, and more. " +
|
|
16
|
+
"Provide uuid (preferred), recordId + databaseName, or recordPath + databaseName.",
|
|
17
|
+
schema: z.object({
|
|
18
|
+
uuid: z.string().optional().describe("UUID of the record"),
|
|
19
|
+
recordId: z.number().int().nonnegative().optional().describe("Numeric record ID (requires databaseName)"),
|
|
20
|
+
recordPath: z.string().optional().describe("Record path within the database (requires databaseName)"),
|
|
21
|
+
databaseName: z.string().optional().describe("Database name (required for recordId or recordPath lookups)"),
|
|
22
|
+
}),
|
|
23
|
+
run: async (args, executor) => {
|
|
24
|
+
const { uuid, recordId, recordPath, databaseName } = args;
|
|
25
|
+
const script = `
|
|
26
|
+
${JXA_APP}
|
|
27
|
+
var uuid = ${jxaLiteral(uuid ?? null)};
|
|
28
|
+
var recordId = ${jxaLiteral(recordId ?? null)};
|
|
29
|
+
var recordPath = ${jxaLiteral(recordPath ?? null)};
|
|
30
|
+
var recordName = null;
|
|
31
|
+
var dbName = ${jxaLiteral(databaseName ?? null)};
|
|
32
|
+
|
|
33
|
+
${JXA_RESOLVE_DB}
|
|
34
|
+
${JXA_RESOLVE_RECORD}
|
|
35
|
+
|
|
36
|
+
JSON.stringify(${JXA_RECORD_PROPS});
|
|
37
|
+
`;
|
|
38
|
+
const result = executor.run(script);
|
|
39
|
+
return JSON.parse(result.stdout);
|
|
40
|
+
},
|
|
41
|
+
});
|
|
42
|
+
//# sourceMappingURL=get-record-properties.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-record-properties.js","sourceRoot":"","sources":["../../../src/tools/records/get-record-properties.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,UAAU,EAA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I,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IACnC,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* move-record.ts — Move a DEVONthink record to a different group.
|
|
3
|
+
*
|
|
4
|
+
* Resolves the source record via uuid, recordId, recordName, or recordPath.
|
|
5
|
+
* Resolves the destination group via destinationGroupUuid.
|
|
6
|
+
* Uses app.move({record: record, to: destGroup}) to perform the move.
|
|
7
|
+
*/
|
|
8
|
+
export declare const moveRecordTool: import("../../jxa/types.js").McpTool;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* move-record.ts — Move a DEVONthink record to a different group.
|
|
3
|
+
*
|
|
4
|
+
* Resolves the source record via uuid, recordId, recordName, or recordPath.
|
|
5
|
+
* Resolves the destination group via destinationGroupUuid.
|
|
6
|
+
* Uses app.move({record: record, to: destGroup}) to perform the move.
|
|
7
|
+
*/
|
|
8
|
+
import { z } from "zod";
|
|
9
|
+
import { defineTool } from "../../jxa/types.js";
|
|
10
|
+
import { jxaLiteral } from "../../jxa/escape.js";
|
|
11
|
+
import { JXA_APP, JXA_RESOLVE_DB, JXA_RESOLVE_RECORD, JXA_RECORD_PROPS } from "../../jxa/helpers.js";
|
|
12
|
+
export const moveRecordTool = defineTool({
|
|
13
|
+
name: "move_record",
|
|
14
|
+
description: "Move a record to a different group in DEVONthink. " +
|
|
15
|
+
"Resolve the source record by uuid (preferred), recordId + databaseName, " +
|
|
16
|
+
"recordName + databaseName, or recordPath + databaseName. " +
|
|
17
|
+
"Provide destinationGroupUuid to specify where to move the record. " +
|
|
18
|
+
"Returns the updated record properties after the move.",
|
|
19
|
+
schema: z.object({
|
|
20
|
+
uuid: z.string().optional().describe("UUID of the record to move"),
|
|
21
|
+
recordId: z.number().int().nonnegative().optional().describe("Numeric record ID (requires databaseName)"),
|
|
22
|
+
recordName: z.string().optional().describe("Record name (requires databaseName, use uuid when possible)"),
|
|
23
|
+
recordPath: z.string().optional().describe("Record path within the database (requires databaseName)"),
|
|
24
|
+
destinationGroupUuid: z.string().optional().describe("UUID of the destination group"),
|
|
25
|
+
databaseName: z.string().optional().describe("Database name (required for recordId, recordName, recordPath)"),
|
|
26
|
+
}),
|
|
27
|
+
run: async (args, executor) => {
|
|
28
|
+
const { uuid, recordId, recordName, recordPath, destinationGroupUuid, databaseName } = args;
|
|
29
|
+
const script = `
|
|
30
|
+
${JXA_APP}
|
|
31
|
+
var uuid = ${jxaLiteral(uuid ?? null)};
|
|
32
|
+
var recordId = ${jxaLiteral(recordId ?? null)};
|
|
33
|
+
var recordName = ${jxaLiteral(recordName ?? null)};
|
|
34
|
+
var recordPath = ${jxaLiteral(recordPath ?? null)};
|
|
35
|
+
var dbName = ${jxaLiteral(databaseName ?? null)};
|
|
36
|
+
var destinationGroupUuid = ${jxaLiteral(destinationGroupUuid ?? null)};
|
|
37
|
+
|
|
38
|
+
${JXA_RESOLVE_DB}
|
|
39
|
+
${JXA_RESOLVE_RECORD}
|
|
40
|
+
|
|
41
|
+
var destGroup = null;
|
|
42
|
+
if (destinationGroupUuid) {
|
|
43
|
+
destGroup = app.getRecordWithUuid(destinationGroupUuid);
|
|
44
|
+
if (!destGroup || !destGroup.uuid()) throw new Error("Destination group not found for UUID: " + destinationGroupUuid);
|
|
45
|
+
} else {
|
|
46
|
+
destGroup = db.root();
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
app.move({record: record, to: destGroup});
|
|
50
|
+
var moved = app.getRecordWithUuid(record.uuid());
|
|
51
|
+
if (!moved || !moved.uuid()) throw new Error("Move operation failed");
|
|
52
|
+
|
|
53
|
+
var record = moved;
|
|
54
|
+
JSON.stringify(${JXA_RECORD_PROPS});
|
|
55
|
+
`;
|
|
56
|
+
const result = executor.run(script);
|
|
57
|
+
return JSON.parse(result.stdout);
|
|
58
|
+
},
|
|
59
|
+
});
|
|
60
|
+
//# sourceMappingURL=move-record.js.map
|
|
@@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,EAAE;QAC5B,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,EAAE,oBAAoB,EAAE,YAAY,EAAE,GAAG,IAAI,CAAC;QAE5F,MAAM,MAAM,GAAG;QACX,OAAO;mBACI,UAAU,CAAC,IAAI,IAAI,IAAI,CAAC;uBACpB,UAAU,CAAC,QAAQ,IAAI,IAAI,CAAC;yBAC1B,UAAU,CAAC,UAAU,IAAI,IAAI,CAAC;yBAC9B,UAAU,CAAC,UAAU,IAAI,IAAI,CAAC;qBAClC,UAAU,CAAC,YAAY,IAAI,IAAI,CAAC;mCAClB,UAAU,CAAC,oBAAoB,IAAI,IAAI,CAAC;;QAEnE,cAAc;QACd,kBAAkB;;;;;;;;;;;;;;;uBAeH,gBAAgB;KAClC,CAAC;QAEF,MAAM,MAAM,GAAG,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QACpC,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IACnC,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* rename-record.ts — Rename a DEVONthink record.
|
|
3
|
+
*
|
|
4
|
+
* Finds a record by UUID and sets its name to newName.
|
|
5
|
+
* Returns the old name, new name, and uuid for confirmation.
|
|
6
|
+
*/
|
|
7
|
+
import { z } from "zod";
|
|
8
|
+
import { defineTool } from "../../jxa/types.js";
|
|
9
|
+
import { jxaLiteral } from "../../jxa/escape.js";
|
|
10
|
+
import { JXA_APP } from "../../jxa/helpers.js";
|
|
11
|
+
export const renameRecordTool = defineTool({
|
|
12
|
+
name: "rename_record",
|
|
13
|
+
description: "Renames a specific record in DEVONthink. " +
|
|
14
|
+
"UUID is required. Provide the new name as newName. " +
|
|
15
|
+
"Returns renamed: true with uuid, oldName, and newName for confirmation.",
|
|
16
|
+
schema: z.object({
|
|
17
|
+
uuid: z.string().describe("UUID of the record to rename"),
|
|
18
|
+
newName: z.string().describe("New name for the record"),
|
|
19
|
+
databaseName: z.string().optional().describe("Database name (optional, for disambiguation)"),
|
|
20
|
+
}),
|
|
21
|
+
run: async (args, executor) => {
|
|
22
|
+
const { uuid, newName } = args;
|
|
23
|
+
const script = `
|
|
24
|
+
${JXA_APP}
|
|
25
|
+
var uuid = ${jxaLiteral(uuid)};
|
|
26
|
+
var newName = ${jxaLiteral(newName)};
|
|
27
|
+
|
|
28
|
+
var record = app.getRecordWithUuid(uuid);
|
|
29
|
+
if (!record || !record.uuid()) throw new Error("Record not found for UUID: " + uuid);
|
|
30
|
+
|
|
31
|
+
var oldName = record.name();
|
|
32
|
+
record.name = newName;
|
|
33
|
+
|
|
34
|
+
JSON.stringify({ renamed: true, uuid: record.uuid(), oldName: oldName, newName: record.name() });
|
|
35
|
+
`;
|
|
36
|
+
const result = executor.run(script);
|
|
37
|
+
return JSON.parse(result.stdout);
|
|
38
|
+
},
|
|
39
|
+
});
|
|
40
|
+
//# sourceMappingURL=rename-record.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rename-record.js","sourceRoot":"","sources":["../../../src/tools/records/rename-record.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAE/C,MAAM,CAAC,MAAM,gBAAgB,GAAG,UAAU,CAAC;IACzC,IAAI,EAAE,eAAe;IACrB,WAAW,EACT,2CAA2C;QAC3C,qDAAqD;QACrD,yEAAyE;IAC3E,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC;QACf,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,8BAA8B,CAAC;QACzD,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,yBAAyB,CAAC;QACvD,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,8CAA8C,CAAC;KAC7F,CAAC;IACF,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE;QAC5B,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;QAE/B,MAAM,MAAM,GAAG;QACX,OAAO;mBACI,UAAU,CAAC,IAAI,CAAC;sBACb,UAAU,CAAC,OAAO,CAAC;;;;;;;;;KASpC,CAAC;QAEF,MAAM,MAAM,GAAG,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QACpC,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IACnC,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* replicate-record.ts — Replicate a DEVONthink record within the same database.
|
|
3
|
+
*
|
|
4
|
+
* Creates a replicant: a record that shares the same underlying data as the original.
|
|
5
|
+
* Changes to any replicant affect all replicants. Requires destination group UUID.
|
|
6
|
+
* Uses app.replicate({record: record, to: destGroup}).
|
|
7
|
+
*/
|
|
8
|
+
export declare const replicateRecordTool: import("../../jxa/types.js").McpTool;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* replicate-record.ts — Replicate a DEVONthink record within the same database.
|
|
3
|
+
*
|
|
4
|
+
* Creates a replicant: a record that shares the same underlying data as the original.
|
|
5
|
+
* Changes to any replicant affect all replicants. Requires destination group UUID.
|
|
6
|
+
* Uses app.replicate({record: record, to: destGroup}).
|
|
7
|
+
*/
|
|
8
|
+
import { z } from "zod";
|
|
9
|
+
import { defineTool } from "../../jxa/types.js";
|
|
10
|
+
import { jxaLiteral } from "../../jxa/escape.js";
|
|
11
|
+
import { JXA_APP, JXA_RESOLVE_DB, JXA_RESOLVE_RECORD, JXA_RECORD_PROPS } from "../../jxa/helpers.js";
|
|
12
|
+
export const replicateRecordTool = defineTool({
|
|
13
|
+
name: "replicate_record",
|
|
14
|
+
description: "Replicate a record within the same database to a destination group. " +
|
|
15
|
+
"Replicants share the same underlying data — editing one affects all replicants. " +
|
|
16
|
+
"Destination group UUID is required. " +
|
|
17
|
+
"Resolve the source record by uuid (preferred), recordId + databaseName, or recordPath + databaseName. " +
|
|
18
|
+
"Returns the properties of the new replicant.",
|
|
19
|
+
schema: z.object({
|
|
20
|
+
uuid: z.string().optional().describe("UUID of the record to replicate"),
|
|
21
|
+
recordId: z.number().int().nonnegative().optional().describe("Numeric record ID (requires databaseName)"),
|
|
22
|
+
recordPath: z.string().optional().describe("Record path within the database (requires databaseName)"),
|
|
23
|
+
destinationGroupUuid: z.string().describe("UUID of the destination group for the replicant"),
|
|
24
|
+
databaseName: z.string().optional().describe("Database name (required for recordId or recordPath lookups)"),
|
|
25
|
+
}),
|
|
26
|
+
run: async (args, executor) => {
|
|
27
|
+
const { uuid, recordId, recordPath, destinationGroupUuid, databaseName } = args;
|
|
28
|
+
const script = `
|
|
29
|
+
${JXA_APP}
|
|
30
|
+
var uuid = ${jxaLiteral(uuid ?? null)};
|
|
31
|
+
var recordId = ${jxaLiteral(recordId ?? null)};
|
|
32
|
+
var recordPath = ${jxaLiteral(recordPath ?? null)};
|
|
33
|
+
var recordName = null;
|
|
34
|
+
var dbName = ${jxaLiteral(databaseName ?? null)};
|
|
35
|
+
var destinationGroupUuid = ${jxaLiteral(destinationGroupUuid)};
|
|
36
|
+
|
|
37
|
+
${JXA_RESOLVE_DB}
|
|
38
|
+
${JXA_RESOLVE_RECORD}
|
|
39
|
+
|
|
40
|
+
var destGroup = app.getRecordWithUuid(destinationGroupUuid);
|
|
41
|
+
if (!destGroup || !destGroup.uuid()) throw new Error("Destination group not found for UUID: " + destinationGroupUuid);
|
|
42
|
+
|
|
43
|
+
var replicant = app.replicate({record: record, to: destGroup});
|
|
44
|
+
if (!replicant || !replicant.uuid()) throw new Error("Replicate operation failed");
|
|
45
|
+
|
|
46
|
+
var record = replicant;
|
|
47
|
+
JSON.stringify(${JXA_RECORD_PROPS});
|
|
48
|
+
`;
|
|
49
|
+
const result = executor.run(script);
|
|
50
|
+
return JSON.parse(result.stdout);
|
|
51
|
+
},
|
|
52
|
+
});
|
|
53
|
+
//# sourceMappingURL=replicate-record.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"replicate-record.js","sourceRoot":"","sources":["../../../src/tools/records/replicate-record.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAErG,MAAM,CAAC,MAAM,mBAAmB,GAAG,UAAU,CAAC;IAC5C,IAAI,EAAE,kBAAkB;IACxB,WAAW,EACT,sEAAsE;QACtE,kFAAkF;QAClF,sCAAsC;QACtC,wGAAwG;QACxG,8CAA8C;IAChD,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC;QACf,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,iCAAiC,CAAC;QACvE,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,2CAA2C,CAAC;QACzG,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,yDAAyD,CAAC;QACrG,oBAAoB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,iDAAiD,CAAC;QAC5F,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,6DAA6D,CAAC;KAC5G,CAAC;IACF,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE;QAC5B,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,oBAAoB,EAAE,YAAY,EAAE,GAAG,IAAI,CAAC;QAEhF,MAAM,MAAM,GAAG;QACX,OAAO;mBACI,UAAU,CAAC,IAAI,IAAI,IAAI,CAAC;uBACpB,UAAU,CAAC,QAAQ,IAAI,IAAI,CAAC;yBAC1B,UAAU,CAAC,UAAU,IAAI,IAAI,CAAC;;qBAElC,UAAU,CAAC,YAAY,IAAI,IAAI,CAAC;mCAClB,UAAU,CAAC,oBAAoB,CAAC;;QAE3D,cAAc;QACd,kBAAkB;;;;;;;;;uBASH,gBAAgB;KAClC,CAAC;QAEF,MAAM,MAAM,GAAG,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QACpC,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IACnC,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* set-record-properties.ts — Set properties on a DEVONthink record.
|
|
3
|
+
*
|
|
4
|
+
* Supports setting: comment, flagged, locking, and the six exclude* flags
|
|
5
|
+
* (excludeFromClassification, excludeFromSearch, excludeFromSeeAlso,
|
|
6
|
+
* excludeFromTagging, excludeFromWikiLinking, excludeFromChat).
|
|
7
|
+
*
|
|
8
|
+
* Resolves the record via uuid, recordId, or recordPath before setting props.
|
|
9
|
+
*/
|
|
10
|
+
export declare const setRecordPropertiesTool: import("../../jxa/types.js").McpTool;
|