Skip to main content
Glama

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
NameRequiredDescriptionDefault
uuidYesUUID of the record whose content to retrieve
databaseNameNoDatabase 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)"),
    }),
  • 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);
      },
    });

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/mnott/Devon'

If you have feedback or need assistance with the MCP directory API, please join our Discord server