Skip to main content
Glama
vjsr007
by vjsr007

graph-import-from-notes

Extract nodes and edges from notes to build knowledge graphs. Import note-to-key and note-to-tag relationships, enabling structured visualization and analysis of semantic connections.

Instructions

Import nodes and edges from existing notes: note -> key and note -> tags.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
keyNo
sourceNo

Implementation Reference

  • src/mcp.ts:179-183 (registration)
    Tool registration in the MCP server tools array, defining name, description, and input schema.
    {
      name: 'graph-import-from-notes',
      description: 'Import nodes and edges from existing notes: note -> key and note -> tags.',
      inputSchema: { type: 'object', properties: { source: { type: 'string', enum: ['all', 'key'] }, key: { type: 'string' } } },
    },
  • Zod schema for validating input parameters: source ('all' or 'key') and optional key.
    export const GraphImportSchema = z.object({
      source: z.enum(['all', 'key']).optional().default('all'),
      key: z.string().optional(),
    });
  • MCP tool call handler: parses input, fetches notes, calls graph.importFromNotes, returns result.
    case 'graph-import-from-notes': {
      const parsed = GraphImportSchema.parse(args ?? {});
      const notes = parsed.source === 'key' && parsed.key ? db.getByKey(parsed.key, 1000) : db.exportAll();
      const res = graph.importFromNotes(notes);
      return { content: [{ type: 'text', text: JSON.stringify(res) }] };
  • SqliteGraphStore.importFromNotes: core implementation creating note/key/tag nodes and edges (note->key, note->tag). Primary impl used when SQLite available.
    importFromNotes(notes: Note[]): { nodes: number; edges: number } {
      let nodesCnt = 0;
      let edgesCnt = 0;
      const tx = this.db.transaction((items: Note[]) => {
        for (const n of items) {
          const noteNodeId = this.upsertNode({ label: `note:${n.id ?? n.key}:${(n.created_at || '').slice(0,10)}`, type: 'note', props: { key: n.key, tags: n.tags ?? [], metadata: n.metadata ?? {} } });
          const keyNodeId = this.upsertNode({ label: `key:${n.key}`, type: 'key' });
          edgesCnt += this.addEdge({ src: noteNodeId, dst: keyNodeId, type: 'has_key' }) ? 1 : 0;
          nodesCnt += 2; // approximate, since upsert may not create new
          for (const t of n.tags ?? []) {
            const tagId = this.upsertNode({ label: `tag:${t}`, type: 'tag' });
            edgesCnt += this.addEdge({ src: noteNodeId, dst: tagId, type: 'has_tag' }) ? 1 : 0;
            nodesCnt++;
          }
        }
      });
      tx(notes);
      // Adjust nodes count by querying totals
      const totals = this.stats();
      return { nodes: totals.nodes, edges: totals.edges };
  • LiteGraphStore.importFromNotes: fallback in-memory implementation with same node/edge creation logic.
    importFromNotes(notes: Note[]): { nodes: number; edges: number } {
      for (const n of notes) {
        const noteNodeId = this.upsertNode({ label: `note:${n.id ?? n.key}:${(n.created_at || '').slice(0,10)}`, type: 'note', props: { key: n.key, tags: n.tags ?? [], metadata: n.metadata ?? {} } });
        const keyNodeId = this.upsertNode({ label: `key:${n.key}`, type: 'key' });
        this.addEdge({ src: noteNodeId, dst: keyNodeId, type: 'has_key' });
        for (const t of n.tags ?? []) {
          const tagId = this.upsertNode({ label: `tag:${t}`, type: 'tag' });
          this.addEdge({ src: noteNodeId, dst: tagId, type: 'has_tag' });
        }
      }
      return this.stats();
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. It states 'import' but doesn't disclose behavioral traits such as whether this is a read-only or mutating operation, what permissions are needed, if it overwrites existing data, or how errors are handled. The description is too minimal to inform the agent adequately about the tool's behavior.

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

Conciseness4/5

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

The description is very concise with a single sentence, front-loaded with the main action. There's no wasted text, but it might be overly terse, risking under-specification rather than true efficiency.

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

Completeness2/5

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

Given no annotations, 0% schema coverage, no output schema, and 2 parameters, the description is incomplete. It doesn't cover parameter details, behavioral aspects, or usage context, leaving significant gaps for the agent to understand how to invoke the tool effectively in a server with multiple graph and index tools.

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

Parameters2/5

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

Schema description coverage is 0%, so the description must compensate. It mentions 'key' and implies 'source' through 'note -> key and note -> tags', but doesn't explain what 'key' or 'source' parameters do, their formats, or how they interact. With 2 parameters and no schema descriptions, this adds minimal meaning beyond the bare schema.

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

Purpose3/5

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

The description states the tool imports nodes and edges from notes, specifying 'note -> key and note -> tags', which gives a vague purpose. It mentions the resource (notes) and transformation (to key/tags) but lacks specificity about what 'import' entails (e.g., into a graph database) and doesn't clearly distinguish from siblings like graph-node-upsert or index-upsert.

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

Usage Guidelines2/5

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

No guidance is provided on when to use this tool versus alternatives. It doesn't mention prerequisites, context (e.g., after creating notes), or exclusions, and with siblings like graph-node-upsert and index-upsert that might handle similar data, the agent has no help in selecting the correct tool.

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/vjsr007/mcp-index-notes'

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