Skip to main content
Glama

create_summary_document

Generate AI-powered summary documents by consolidating multiple DEVONthink records into concise formats like markdown, key points, or tables for efficient information synthesis.

Instructions

Create an AI-generated summary document from multiple DEVONthink documents.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
documentUuidsYesUUIDs of the source DEVONthink records to summarize
summaryTypeNoOutput format for the summary document. One of: markdown, rich, sheet, simple. Defaults to markdown
summaryStyleNoStyle of summary to generate. One of: text summary, key points summary, list summary, table summary, custom summary
parentGroupUuidNoUUID of the group where the summary document should be created. If omitted, the summary is placed in the same group as the first source record
customTitleNoTitle for the new summary record. Defaults to 'Summary - <ISO date>' if omitted

Implementation Reference

  • The `run` function implementation that handles the tool logic, including script construction and execution.
      run: async (args, executor) => {
        const { documentUuids, summaryType, summaryStyle, parentGroupUuid, customTitle } = args;
    
        const script = `
          ${JXA_APP}
          var uuids = ${jxaLiteral(documentUuids)};
          var summaryType = ${jxaLiteral(summaryType ?? "markdown")};
          var summaryStyle = ${jxaLiteral(summaryStyle ?? null)};
          var parentGroupUuid = ${jxaLiteral(parentGroupUuid ?? null)};
          var customTitle = ${jxaLiteral(customTitle ?? null)};
    
          // Resolve source records
          var records = [];
          for (var i = 0; i < uuids.length; i++) {
            var rec = app.getRecordWithUuid(uuids[i]);
            if (!rec || !rec.uuid()) {
              throw new Error("Record not found for UUID: " + uuids[i]);
            }
            records.push(rec);
          }
    
          // Resolve destination group
          var parentGroup = null;
          if (parentGroupUuid) {
            parentGroup = app.getRecordWithUuid(parentGroupUuid);
            if (!parentGroup || !parentGroup.uuid()) {
              throw new Error("Parent group not found for UUID: " + parentGroupUuid);
            }
          } else {
            // Default: same group as the first source record
            parentGroup = records[0].parent();
          }
    
          // Build summarization options
          var summarizeOpts = {
            records: records,
            to: summaryType,
            in: parentGroup
          };
          if (summaryStyle) summarizeOpts["as"] = summaryStyle;
    
          // Call DEVONthink's AI summarization
          var summaryRecord = app.summarizeContentsOf(summarizeOpts);
          if (!summaryRecord || !summaryRecord.uuid()) {
            throw new Error("DEVONthink did not return a summary record");
          }
    
          var record = summaryRecord;
          JSON.stringify(${JXA_RECORD_PROPS});
        `;
    
        const result = executor.run(script);
        return JSON.parse(result.stdout);
      },
    });
  • Input schema defined using zod for validating tool arguments.
    schema: z.object({
      documentUuids: z
        .array(z.string())
        .min(1)
        .describe("UUIDs of the source DEVONthink records to summarize"),
      summaryType: z
        .enum(SUMMARY_TYPE_VALUES)
        .optional()
        .describe(
          "Output format for the summary document. " +
          "One of: markdown, rich, sheet, simple. Defaults to markdown"
        ),
      summaryStyle: z
        .enum(SUMMARY_STYLE_VALUES)
        .optional()
        .describe(
          "Style of summary to generate. " +
          "One of: text summary, key points summary, list summary, table summary, custom summary"
        ),
      parentGroupUuid: z
        .string()
        .optional()
        .describe(
          "UUID of the group where the summary document should be created. " +
          "If omitted, the summary is placed in the same group as the first source record"
        ),
      customTitle: z
        .string()
        .optional()
        .describe(
          "Title for the new summary record. Defaults to 'Summary - <ISO date>' if omitted"
        ),
    }),
  • Definition of the tool with name, description, and schema.
    export const createSummaryDocumentTool = defineTool({
      name: "create_summary_document",

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