update_record_content
Modify existing record content in DEVONthink by providing UUID and new text or source material for text, HTML, or Markdown documents.
Instructions
Updates the content of an existing record in DEVONthink. For text records, sets plain text. For HTML/Markdown records, sets the source. UUID is required. Returns updated: true with uuid and name on success.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| uuid | Yes | UUID of the record to update | |
| content | Yes | New content to write to the record |
Implementation Reference
- The complete tool definition, including schema validation and the handler (run function) which uses JXA to update a DEVONthink record.
export const updateRecordContentTool = defineTool({ name: "update_record_content", description: "Updates the content of an existing record in DEVONthink. " + "For text records, sets plain text. For HTML/Markdown records, sets the source. " + "UUID is required. Returns updated: true with uuid and name on success.", schema: z.object({ uuid: z.string().describe("UUID of the record to update"), content: z.string().describe("New content to write to the record"), }), run: async (args, executor) => { const { uuid, content } = args; const script = ` ${JXA_APP} var uuid = ${jxaLiteral(uuid)}; var content = ${jxaLiteral(content)}; var record = app.getRecordWithUuid(uuid); if (!record || !record.uuid()) throw new Error("Record not found for UUID: " + uuid); var recordType = record.type(); if (recordType === "html" || recordType === "markdown" || recordType === "feed") { record.source = content; } else { record.plainText = content; } JSON.stringify({ updated: true, uuid: record.uuid(), name: record.name() }); `; const result = executor.run(script); return JSON.parse(result.stdout); }, });