Skip to main content
Glama

add_document

Compare modified documents with original versions, chunk content, identify changes, and sync differences to a knowledge graph for structured document management.

Instructions

Compare new file with ROOT original file and sync differences to Graphiti.

This tool compares a modified document with its original version in the ROOT
directory, chunks both versions, identifies changes, and syncs the differences
to the Graphiti knowledge graph.

Args:
    new_file_path: Absolute path to the new/modified file
    project_id: Project identifier (e.g., "knowledge-smith")
    feature_id: Feature identifier (required for RBT documents)
    rbt_type: RBT document type ("REQ"/"BP"/"TASK"). Leave as None for general documents.
    file_path:
        - For RBT TASK: task identifier (e.g., "006")
        - For general files: relative path (e.g., "todos/xxx.md" or "docs/todos/xxx.md")
          Note: "docs/" prefix is optional and will be handled automatically.

Returns:
    Sync statistics:
    {
        "status": "success",
        "added": 3,      # Number of chunks added
        "updated": 2,    # Number of chunks updated
        "deleted": 1,    # Number of chunks deleted
        "unchanged": 5,  # Number of chunks unchanged
        "total": 11      # Total chunks
    }

Raises:
    FileNotFoundError: If new file not found
    ValueError: If invalid rbt_type or parameter combination

Examples:
    # RBT TASK document
    add_document(
        new_file_path="/Users/me/workspace/TASK-006-AddDocument.md",
        project_id="knowledge-smith",
        feature_id="graphiti-chunk-mcp",
        rbt_type="TASK",
        file_path="006"
    )

    # RBT BP document
    add_document(
        new_file_path="/Users/me/workspace/BP-graphiti-chunk-mcp.md",
        project_id="knowledge-smith",
        feature_id="graphiti-chunk-mcp",
        rbt_type="BP"
    )

    # General document (both work)
    add_document(
        new_file_path="/Users/me/workspace/TODO-001.md",
        project_id="General",
        file_path="todos/TODO-001.md"  # or "docs/todos/TODO-001.md"
    )

@REQ: REQ-graphiti-chunk-mcp
@BP: BP-graphiti-chunk-mcp
@TASK: TASK-006-AddDocument

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
new_file_pathYes
project_idYes
feature_idNo
rbt_typeNo
file_pathNo

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/leo7nel23/KnowledgeSmith-MCP'

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