Skip to main content
Glama

create_record

Add new records to DEVONthink databases by specifying name and type, with options for content, URLs, parent groups, and target databases.

Instructions

Create a new record in DEVONthink. Specify name and type (e.g. 'markdown', 'txt', 'rtf', 'html', 'bookmark', 'group'). Optionally provide content, url, a parent group UUID, and database name. Returns the full properties of the newly created record.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesName for the new record
typeYesRecord type: 'markdown', 'txt', 'rtf', 'html', 'bookmark', 'group', etc.
contentNoInitial text content for the record
urlNoURL for bookmark records or to associate with the record
parentGroupUuidNoUUID of the parent group (defaults to database root)
databaseNameNoTarget database name (defaults to current database)

Implementation Reference

  • The create_record tool handler, schema definition, and execution logic.
    export const createRecordTool = defineTool({
      name: "create_record",
      description:
        "Create a new record in DEVONthink. " +
        "Specify name and type (e.g. 'markdown', 'txt', 'rtf', 'html', 'bookmark', 'group'). " +
        "Optionally provide content, url, a parent group UUID, and database name. " +
        "Returns the full properties of the newly created record.",
      schema: z.object({
        name: z.string().describe("Name for the new record"),
        type: z.string().describe("Record type: 'markdown', 'txt', 'rtf', 'html', 'bookmark', 'group', etc."),
        content: z.string().optional().describe("Initial text content for the record"),
        url: z.string().optional().describe("URL for bookmark records or to associate with the record"),
        parentGroupUuid: z.string().optional().describe("UUID of the parent group (defaults to database root)"),
        databaseName: z.string().optional().describe("Target database name (defaults to current database)"),
      }),
      run: async (args, executor) => {
        const { name, type, content, url, parentGroupUuid, databaseName } = args;
    
        const script = `
          ${JXA_APP}
          var dbName = ${jxaLiteral(databaseName ?? null)};
          var parentGroupUuid = ${jxaLiteral(parentGroupUuid ?? null)};
    
          ${JXA_RESOLVE_DB}
    
          var props = {
            name: ${jxaLiteral(name)},
            type: ${jxaLiteral(type)}
          };
    
          var contentVal = ${jxaLiteral(content ?? null)};
          if (contentVal !== null) props.content = contentVal;
    
          var urlVal = ${jxaLiteral(url ?? null)};
          if (urlVal !== null) props.URL = urlVal;
    
          var location;
          if (parentGroupUuid) {
            var parentGroup = app.getRecordWithUuid(parentGroupUuid);
            if (!parentGroup || !parentGroup.uuid()) throw new Error("Parent group not found for UUID: " + parentGroupUuid);
            location = {in: parentGroup};
          } else {
            location = {in: db};
          }
    
          var record = app.createRecordWith(props, location);
          if (!record || !record.uuid()) throw new Error("Failed to create record");
    
          JSON.stringify(${JXA_RECORD_PROPS});
        `;
    
        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