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

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior4/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It does an excellent job describing the tool's behavior: chunking both versions, identifying changes, syncing differences, and returning statistics. It also documents error conditions (FileNotFoundError, ValueError) and includes detailed examples showing different usage patterns.

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 well-structured with clear sections (purpose, args, returns, raises, examples, references). While comprehensive, it could be slightly more concise - some information in the examples duplicates parameter explanations. However, every sentence adds value and the front-loaded purpose statement is excellent.

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

Completeness5/5

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

Given the tool's complexity (5 parameters, mutation operation, conditional logic) and the presence of an output schema, the description is complete. It explains the tool's purpose, parameters, return values, error conditions, and provides multiple usage examples. The output schema handles return value documentation, allowing the description to focus on behavior and usage.

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

Parameters5/5

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

With 0% schema description coverage, the description fully compensates by providing comprehensive parameter documentation. Each parameter is explained with clear semantics, examples, and conditional logic (e.g., 'required for RBT documents', 'Leave as None for general documents'). The file_path parameter gets particularly detailed treatment with different interpretations based on document type.

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?

The description clearly states the tool's purpose with specific verbs ('compare', 'sync differences') and resources ('new file', 'ROOT original file', 'Graphiti knowledge graph'). It distinguishes itself from siblings by focusing on document comparison and synchronization rather than graph manipulation or search operations.

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

Usage Guidelines4/5

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

The description provides clear context about when to use this tool (comparing modified documents with originals and syncing to Graphiti). It includes examples for different document types (RBT TASK, RBT BP, general documents) but doesn't explicitly state when NOT to use it or name specific alternatives among sibling tools.

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

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