Skip to main content
Glama

dump_project_understanding

Analyze and extract comprehensive project insights, including entities, relationships, patterns, and style conventions, from a specified root directory using SourceSage's MCP server.

Instructions

Dump understanding of an entire project at once.

This tool provides a comprehensive dump of all knowledge related to a project, including all entities, relationships, patterns, and style conventions.

Args: project_path: Path to the project root directory include_observations: Whether to include detailed observations

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
include_observationsNo
project_pathYes

Implementation Reference

  • The core handler function for the 'dump_project_understanding' MCP tool. It is registered via the @self.mcp.tool() decorator. The function signature provides the input schema (project_path: str, include_observations: bool -> str). It gathers all entities and relations associated with the given project_path from self.knowledge, groups them, and formats a comprehensive textual dump, optionally including observations, patterns, and style conventions.
    @self.mcp.tool()
    def dump_project_understanding(
        project_path: str, include_observations: bool = False
    ) -> str:
        """Dump understanding of an entire project at once.
    
        This tool provides a comprehensive dump of all knowledge related to a project,
        including all entities, relationships, patterns, and style conventions.
    
        Args:
            project_path: Path to the project root directory
            include_observations: Whether to include detailed observations
        """
        # 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}"
    
        # Get all relations involving project entities
        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"
    
        # Group entities by type
        entities_by_type = {}
        for entity in project_entities:
            if entity.entity_type not in entities_by_type:
                entities_by_type[entity.entity_type] = []
            entities_by_type[entity.entity_type].append(entity)
    
        # Output entities by type
        for entity_type, entities in sorted(entities_by_type.items()):
            output += f"{entity_type.capitalize()} Entities ({len(entities)}):\n"
    
            for entity in sorted(entities, key=lambda e: e.name):
                output += f"- {entity.name}\n"
                output += f"  Summary: {entity.summary}\n"
    
                if entity.signature:
                    output += f"  Signature: {entity.signature}\n"
    
                if entity.language:
                    output += f"  Language: {entity.language}\n"
    
                # Include observations if requested
                if include_observations and entity.observations:
                    output += "  Observations:\n"
                    for observation in entity.observations:
                        output += f"    - {observation}\n"
    
                # Include relations
                entity_relations = [
                    r for r in project_relations if r.from_id == entity.entity_id
                ]
                if entity_relations:
                    output += "  Relations:\n"
                    for relation in entity_relations:
                        to_entity = self.knowledge.get_entity(relation.to_id)
                        if to_entity:
                            output += f"    - {relation.relation_type} -> {to_entity.name} ({to_entity.entity_type})\n"
    
                output += "\n"
    
            output += "\n"
    
        # Include patterns and style conventions if any are associated with this project
        project_patterns = []
        for pattern in self.knowledge.patterns.values():
            if pattern.metadata.get("project_path") == project_path:
                project_patterns.append(pattern)
    
        if project_patterns:
            output += f"Patterns ({len(project_patterns)}):\n"
            for pattern in project_patterns:
                output += f"- {pattern.name}: {pattern.description}\n"
            output += "\n"
    
        project_conventions = []
        for convention in self.knowledge.style_conventions.values():
            if convention.metadata.get("project_path") == project_path:
                project_conventions.append(convention)
    
        if project_conventions:
            output += f"Style Conventions ({len(project_conventions)}):\n"
            for convention in project_conventions:
                output += f"- {convention.name}: {convention.description}\n"
            output += "\n"
    
        return output
Behavior2/5

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

With no annotations provided, the description carries full burden but provides minimal behavioral context. It mentions 'comprehensive dump' but doesn't describe format, size limitations, performance characteristics, or what 'knowledge' specifically entails. No information about permissions, side effects, or response structure is included.

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 appropriately sized with clear front-loading of the main purpose. The two-sentence main description is efficient, and the parameter explanations are brief but clear. No wasted words, though the formatting with separate 'Args:' section could be more integrated.

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?

For a tool with 2 parameters, 0% schema coverage, no annotations, and no output schema, the description is insufficient. It doesn't explain what the output looks like (despite no output schema), what 'knowledge' specifically includes, or how this dump differs from loading/querying alternatives. The behavioral context is particularly lacking for a comprehensive data retrieval tool.

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 description coverage is 0%, so the description must compensate. It provides basic explanations for both parameters: 'Path to the project root directory' for project_path and 'Whether to include detailed observations' for include_observations. However, it doesn't explain what 'observations' specifically are or provide format details for the path parameter.

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 the tool 'provides a comprehensive dump of all knowledge related to a project' with specific components like 'entities, relationships, patterns, and style conventions'. It distinguishes from siblings like get_entity_details or query_entities by emphasizing 'entire project at once' and 'all knowledge', though it doesn't explicitly name alternatives.

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

Usage Guidelines3/5

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

The description implies usage for getting comprehensive project understanding versus more targeted sibling tools, but doesn't explicitly state when to use this versus alternatives like load_project_understanding or get_knowledge_statistics. No explicit exclusions or prerequisites are mentioned.

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

Related 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/sarathsp06/sourcesage'

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