Skip to main content
Glama

Graph Ingest

graph_ingest
Idempotent

Queue a document for background extraction into a memory graph, or check the ingest backlog. Use for files that don't need immediate reflection in conversation.

Instructions

Queue a document for asynchronous extraction into the memory graph (mode='queue'), or check the ingest backlog (mode='status'). Use this when you have a file the user wants summarized into the graph but doesn't need it reflected in the same conversation — the nightly dream process picks queued documents up. For inline assertions during a conversation, call graph_relate directly instead. Idempotent: queueing the same file twice overwrites the prior copy in the pending dir.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
actionYesqueue: add file to pending. status: check queue.
file_pathNoPath to file to queue (required for queue action)
metaNoOptional metadata for the queued document

Implementation Reference

  • Registration and handler for the graph_ingest tool. The tool supports two actions: 'queue' (copy a file into the ingest/pending directory with optional metadata) and 'status' (list pending and recently completed ingest files). The handler is self-contained with no calls to Neo4jClient.
    server.registerTool("graph_ingest", {
      title: "Graph Ingest",
      description:
        "Queue a document for asynchronous extraction into the memory graph (mode='queue'), or check the ingest backlog (mode='status'). Use this when you have a file the user wants summarized into the graph but doesn't need it reflected in the same conversation — the nightly dream process picks queued documents up. For inline assertions during a conversation, call graph_relate directly instead. Idempotent: queueing the same file twice overwrites the prior copy in the pending dir.",
      inputSchema: {
        action: z.enum(["queue", "status"]).describe("queue: add file to pending. status: check queue."),
        file_path: z.string().optional().describe("Path to file to queue (required for queue action)"),
        meta: z.object({
          source: z.string().optional(),
          author: z.string().optional(),
          date: z.string().optional(),
          topic_hints: z.array(z.string()).optional(),
          weight_override: z.number().optional(),
        }).optional().describe("Optional metadata for the queued document"),
      },
      annotations: { idempotentHint: true },
    }, async (args) => {
      try {
        const pendingDir = join(GRAPH_MEMORY_HOME, "ingest", "pending");
        const completedDir = join(GRAPH_MEMORY_HOME, "ingest", "completed");
    
        if (args.action === "status") {
          let pending: Array<{ file: string; queued_at: string; size: string }> = [];
          let recentlyCompleted: Array<{ file: string; processed_at: string }> = [];
    
          try {
            const pendingFiles = readdirSync(pendingDir).filter((f) => !f.endsWith(".meta.json"));
            pending = pendingFiles.map((f) => {
              const stat = statSync(join(pendingDir, f));
              return {
                file: f,
                queued_at: stat.mtime.toISOString(),
                size: `${(stat.size / 1024).toFixed(1)} KB`,
              };
            });
          } catch { /* dir doesn't exist yet */ }
    
          try {
            const completedFiles = readdirSync(completedDir).filter((f) => !f.endsWith(".meta.json"));
            recentlyCompleted = completedFiles.slice(-5).map((f) => {
              const stat = statSync(join(completedDir, f));
              return { file: f, processed_at: stat.mtime.toISOString() };
            });
          } catch { /* dir doesn't exist yet */ }
    
          return toolResult({
            pending,
            recently_completed: recentlyCompleted,
            pending_count: pending.length,
            completed_count: recentlyCompleted.length,
          });
        }
    
        // Queue action
        if (!args.file_path) {
          return toolError("file_path is required for queue action");
        }
    
        mkdirSync(pendingDir, { recursive: true });
        const destName = basename(args.file_path);
        const destPath = join(pendingDir, destName);
        copyFileSync(args.file_path, destPath);
    
        if (args.meta) {
          const metaPath = join(pendingDir, `${destName}.meta.json`);
          writeFileSync(metaPath, JSON.stringify(args.meta, null, 2));
        }
    
        return toolResult({
          action: "queued",
          file: destName,
          destination: destPath,
          meta_written: !!args.meta,
        });
      } catch (err) {
        return toolError(`graph_ingest failed: ${err instanceof Error ? err.message : String(err)}`);
      }
    });
  • Input schema for graph_ingest. Accepts action (queue/status), optional file_path, and optional meta object with source, author, date, topic_hints, and weight_override.
    inputSchema: {
      action: z.enum(["queue", "status"]).describe("queue: add file to pending. status: check queue."),
      file_path: z.string().optional().describe("Path to file to queue (required for queue action)"),
      meta: z.object({
        source: z.string().optional(),
        author: z.string().optional(),
        date: z.string().optional(),
        topic_hints: z.array(z.string()).optional(),
        weight_override: z.number().optional(),
      }).optional().describe("Optional metadata for the queued document"),
    },
Behavior5/5

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

Describes idempotent behavior beyond the annotation, explaining that queueing same file overwrites. Also mentions async processing by nightly dream process, adding valuable behavioral context.

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?

Description is concise and well-structured: first sentence states main function, then usage guidance, alternative, and idempotency. Every sentence adds value without redundancy.

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

Completeness4/5

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

Covers two modes, usage guidance, and idempotency. However, no output schema exists and the description omits what status returns (e.g., backlog count). Minor gap but largely complete.

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 coverage is 100% with clear descriptions for all parameters. The description restates the action modes but does not add new meaning beyond the schema, so baseline score applies.

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

Purpose5/5

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

Description clearly states it queues a document for async extraction or checks status, distinguishing two modes. It also contrasts with graph_relate, a sibling tool, making purpose unambiguous.

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

Usage Guidelines5/5

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

Explicitly says when to use (file for graph summarization, not needed in conversation) and when not to (inline assertions, use graph_relate). Provides clear context for decision-making.

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/stevepridemore/graph-memory'

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