Skip to main content
Glama

load_project_understanding

Retrieve comprehensive project insights, including entities, relationships, patterns, and style conventions, by loading project understanding directly from the root directory, eliminating the need for individual file analysis.

Instructions

Load understanding of an entire project at once.

This tool should be used by MCP clients to quickly get project understanding if available, instead of reading all the files individually. It loads all entities, relationships, patterns, and style conventions related to the project.

Args: project_path: Path to the project root directory

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
project_pathYes

Implementation Reference

  • The handler function for the 'load_project_understanding' MCP tool. It is decorated with @self.mcp.tool() which registers it as an MCP tool. The function retrieves and formats a summary of the project's knowledge graph data, including entities and relations associated with the given project_path.
    @self.mcp.tool()
    def load_project_understanding(project_path: str) -> str:
        """Load understanding of an entire project at once.
    
        This tool should be used by MCP clients to quickly get project understanding
        if available, instead of reading all the files individually. It loads all
        entities, relationships, patterns, and style conventions related to the project.
    
        Args:
            project_path: Path to the project root directory
        """
        # Normalize the project path
        project_path = os.path.normpath(os.path.abspath(project_path))
    
        # Check if we have any entities related to this project
        project_entities = []
        for entity in self.knowledge.entities.values():
            entity_project = entity.metadata.get("project_path")
            if (
                entity_project
                and os.path.normpath(os.path.abspath(entity_project))
                == project_path
            ):
                project_entities.append(entity)
    
        if not project_entities:
            return f"No understanding available for project at: {project_path}"
    
        # Count entities by type
        entity_types = {}
        for entity in project_entities:
            entity_types[entity.entity_type] = (
                entity_types.get(entity.entity_type, 0) + 1
            )
    
        # Count relations
        project_entity_ids = {entity.entity_id for entity in project_entities}
        project_relations = []
        for relation in self.knowledge.relations.values():
            if (
                relation.from_id in project_entity_ids
                or relation.to_id in project_entity_ids
            ):
                project_relations.append(relation)
    
        # Format output
        output = f"Project Understanding for: {project_path}\n\n"
        output += f"Total Entities: {len(project_entities)}\n"
        output += f"Total Relations: {len(project_relations)}\n\n"
    
        if entity_types:
            output += "Entities by Type:\n"
            for entity_type, count in entity_types.items():
                output += f"- {entity_type}: {count}\n"
            output += "\n"
    
        # List key entities (e.g., modules, classes)
        key_entities = [
            e
            for e in project_entities
            if e.entity_type in ["module", "class", "interface"]
        ]
        if key_entities:
            output += "Key Components:\n"
            for entity in sorted(key_entities, key=lambda e: e.name)[
                :10
            ]:  # Limit to 10
                output += (
                    f"- {entity.name} ({entity.entity_type}): {entity.summary}\n"
                )
    
            if len(key_entities) > 10:
                output += f"... and {len(key_entities) - 10} more key components\n"
            output += "\n"
    
        # List all entities
        output += "All Entities:\n"
        for entity in sorted(project_entities, key=lambda e: e.name)[
            :30
        ]:  # Limit to 30 to avoid excessive output
            output += f"- {entity.name} ({entity.entity_type}): {entity.summary}\n"
    
        if len(project_entities) > 30:
            output += f"... and {len(project_entities) - 30} more entities\n"
        output += "\n"
    
        return output

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

B3.3/5.0
Behavior3/5

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

With no annotations provided, the description carries the full burden. It describes the tool as loading data (likely read-only) but does not confirm side effects, caching, or network dependencies. The behavioral information is adequate but could be more explicit.

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 relatively concise with an actionable first sentence. However, it includes a redundant 'Args:' section that mirrors the schema, taking unnecessary space.

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 output schema, the description should explain the return structure or format. It only lists what is loaded but not how it is presented. Additionally, it does not differentiate from the sibling 'dump_project_understanding', leaving the agent without full context.

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?

The only parameter 'project_path' is described as 'Path to the project root directory', which adds no meaning beyond the input schema's title. With 0% schema description coverage, the description should provide more context, such as format or examples.

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 clearly states it loads project understanding including entities, relationships, patterns, and style conventions, distinguishing it from reading files individually. However, it does not differentiate from the sibling tool 'dump_project_understanding', which likely has a similar purpose.

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 explicitly recommends using this tool instead of reading all files individually, providing clear context for when to use it. It does not, however, list exclusions or alternatives beyond reading files, such as the sibling 'dump_project_understanding'.

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