get_record_content
Retrieve plain text or HTML content from DEVONthink records using UUID. Returns text for text-based records, HTML for web content, or null for binary files like PDFs and images.
Instructions
Gets the content of a specific record in DEVONthink. Returns plain text for text-based records, or HTML source for web/HTML records. Binary records (PDF, images) return null for content. UUID is required; databaseName is optional.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| uuid | Yes | UUID of the record whose content to retrieve | |
| databaseName | No | Database name (optional, for disambiguation) |
Implementation Reference
- The 'run' function within the getRecordContentTool definition executes the JXA script to retrieve record content from DEVONthink.
run: async (args, executor) => { const { uuid, databaseName } = args; const script = ` ${JXA_APP} var uuid = ${jxaLiteral(uuid)}; var dbName = ${jxaLiteral(databaseName ?? null)}; var record = app.getRecordWithUuid(uuid); if (!record || !record.uuid()) throw new Error("Record not found for UUID: " + uuid); var content = null; try { content = record.plainText(); } catch(e) {} if (!content) { try { content = record.source(); } catch(e) {} } JSON.stringify({ uuid: record.uuid(), name: record.name(), type: record.type(), content: content || null }); `; const result = executor.run(script); return JSON.parse(result.stdout); }, - Input validation schema for the get_record_content tool.
schema: z.object({ uuid: z.string().describe("UUID of the record whose content to retrieve"), databaseName: z.string().optional().describe("Database name (optional, for disambiguation)"), }), - src/tools/records/get-record-content.ts:13-52 (registration)Registration of the get_record_content tool using defineTool.
export const getRecordContentTool = defineTool({ name: "get_record_content", description: "Gets the content of a specific record in DEVONthink. " + "Returns plain text for text-based records, or HTML source for web/HTML records. " + "Binary records (PDF, images) return null for content. " + "UUID is required; databaseName is optional.", schema: z.object({ uuid: z.string().describe("UUID of the record whose content to retrieve"), databaseName: z.string().optional().describe("Database name (optional, for disambiguation)"), }), run: async (args, executor) => { const { uuid, databaseName } = args; const script = ` ${JXA_APP} var uuid = ${jxaLiteral(uuid)}; var dbName = ${jxaLiteral(databaseName ?? null)}; var record = app.getRecordWithUuid(uuid); if (!record || !record.uuid()) throw new Error("Record not found for UUID: " + uuid); var content = null; try { content = record.plainText(); } catch(e) {} if (!content) { try { content = record.source(); } catch(e) {} } JSON.stringify({ uuid: record.uuid(), name: record.name(), type: record.type(), content: content || null }); `; const result = executor.run(script); return JSON.parse(result.stdout); }, });