Skip to main content
Glama

ask_ai_about_documents

Analyze, compare, or extract information from DEVONthink documents by asking AI questions about specific records. Get insights from your documents through targeted queries.

Instructions

Ask AI questions about specific DEVONthink documents for analysis, comparison, or extraction.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
documentUuidsYesOne or more DEVONthink record UUIDs to use as context for the AI question
questionYesThe question or instruction to send to the AI about the documents
temperatureNoSampling temperature for the AI response (0 = deterministic, 2 = creative). Defaults to 0.7
modelNoOptional AI model name to use (e.g. 'gpt-4o', 'claude-3-5-sonnet'). Uses DEVONthink default if omitted
engineNoOptional AI engine to use. Uses DEVONthink's configured default if omitted

Implementation Reference

  • The tool definition and implementation handler for 'ask_ai_about_documents', which uses JXA to interface with DEVONthink's AI capabilities.
    export const askAiAboutDocumentsTool = defineTool({
      name: "ask_ai_about_documents",
      description:
        "Ask AI questions about specific DEVONthink documents for analysis, comparison, or extraction.",
      schema: z.object({
        documentUuids: z
          .array(z.string())
          .min(1)
          .describe("One or more DEVONthink record UUIDs to use as context for the AI question"),
        question: z
          .string()
          .min(1)
          .max(10000)
          .describe("The question or instruction to send to the AI about the documents"),
        temperature: z
          .number()
          .min(0)
          .max(2)
          .optional()
          .describe("Sampling temperature for the AI response (0 = deterministic, 2 = creative). Defaults to 0.7"),
        model: z
          .string()
          .optional()
          .describe("Optional AI model name to use (e.g. 'gpt-4o', 'claude-3-5-sonnet'). Uses DEVONthink default if omitted"),
        engine: z
          .enum(ENGINE_VALUES)
          .optional()
          .describe("Optional AI engine to use. Uses DEVONthink's configured default if omitted"),
      }),
      run: async (args, executor) => {
        const { documentUuids, question, temperature, model, engine } = args;
    
        const script = `
          ${JXA_APP}
          var uuids = ${jxaLiteral(documentUuids)};
          var question = ${jxaLiteral(question)};
          var temperature = ${jxaLiteral(temperature ?? 0.7)};
          var modelName = ${jxaLiteral(model ?? null)};
          var engineName = ${jxaLiteral(engine ?? null)};
    
          // Resolve each UUID to a DEVONthink record
          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);
          }
    
          // Build AI call options
          var aiOpts = { record: records, temperature: temperature };
          if (engineName) aiOpts["engine"] = engineName;
          if (modelName) aiOpts["model"] = modelName;
    
          // Call DEVONthink's AI
          var answer = app.getChatResponseForMessage(question, aiOpts);
    
          JSON.stringify({
            answer: answer || null,
            documentCount: records.length,
            question: question
          });
        `;
    
        const result = executor.run(script);
        return JSON.parse(result.stdout) as {
          answer: string | null;
          documentCount: number;
          question: string;
        };
      },
    });
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It fails to clarify whether this tool modifies DEVONthink records, creates new documents, or is read-only; nor does it mention costs, rate limits, or output format expectations for the AI interaction.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence with no wasted words. It is appropriately front-loaded with the core action and maintains high information density.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the 5 parameters, lack of annotations, and absence of an output schema, the description meets minimum viability by stating the core function. However, it lacks critical context about return values, side effects, or error handling that would help an agent predict the tool's impact and results.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, establishing a baseline of 3. The description adds minimal semantic value beyond the schema, though it implicitly frames the 'question' parameter around the use cases mentioned (analysis, comparison, extraction). It does not add syntax details or parameter relationships beyond what the schema provides.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description provides a clear verb ('Ask'), resource ('AI'), and scope ('DEVONthink documents') with specific use cases ('analysis, comparison, or extraction'). However, it does not explicitly differentiate from siblings like 'compare', 'classify', or 'create_summary_document' which offer overlapping AI-powered functionality.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description lists applicable use cases (analysis, comparison, extraction), providing implied guidance on when to use the tool. However, it lacks explicit guidance on when NOT to use it or which sibling tools ('compare', 'create_summary_document') might be more appropriate for specific tasks.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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