Skip to main content
Glama

Inspect Project

inspect_project

Analyze project directories to detect languages, frameworks, entry points, structure, and dependencies for comprehensive project understanding.

Instructions

Analyze a project directory and return a complete snapshot including detected languages, frameworks, entry points, structure summary, and dependencies. This is the primary tool for understanding a project.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYesPath to the project directory to inspect
maxDepthNoMaximum depth to scan (default: 3)
includeHiddenNoInclude hidden files and directories

Implementation Reference

  • Main inspect_project tool handler. Validates project path, scans directory tree, detects languages/frameworks/entry points/project type/dependencies/config files, and returns comprehensive snapshot.
    export async function inspectProject({ path: projectPath, maxDepth = 3, includeHidden = false }) {
        // Validate path exists
        try {
            const stats = await fs.stat(projectPath);
            if (!stats.isDirectory()) {
                return createError(ErrorCodes.PATH_NOT_DIRECTORY);
            }
        } catch (err) {
            if (err.code === 'ENOENT') {
                return createError(ErrorCodes.PATH_NOT_FOUND);
            }
            if (err.code === 'EACCES') {
                return createError(ErrorCodes.ACCESS_DENIED);
            }
            return createError(ErrorCodes.SCAN_ERROR, err.message);
        }
    
        try {
            // Scan directory tree
            const { files, structure, truncated } = await scanTree(projectPath, {
                maxDepth,
                includeHidden
            });
    
            // Parse dependencies
            const dependencies = await parseDependencies(projectPath, files);
    
            // Detect languages
            const languages = await detectLanguages(projectPath, files);
    
            // Detect frameworks
            const frameworks = await detectFrameworks(projectPath, files, languages, dependencies);
    
            // Detect entry points
            const entryPoints = await detectEntryPoints(projectPath, files, languages);
    
            // Classify project type
            const projectType = await classifyProjectType(frameworks, languages, files, projectPath);
    
            // Get structure summary
            const structureSummary = getStructureSummary(structure, files);
    
            // Find config files
            const sigs = await getSignatures();
            const configFiles = files.filter(f =>
                sigs.configFiles.some(cf => path.basename(f) === cf || f.endsWith(cf))
            );
    
            // Build result (omit empty fields)
            const result = {
                project: {
                    language: languages.map(l => l.name),
                    type: projectType.type,
                    confidence: projectType.confidence
                }
            };
    
            if (frameworks.length > 0) {
                result.frameworks = frameworks.map(f => ({
                    name: f.name,
                    confidence: f.confidence
                }));
            }
    
            if (entryPoints.length > 0) {
                result.entryPoints = entryPoints;
            }
    
            if (Object.keys(structureSummary).length > 0) {
                result.structureSummary = structureSummary;
            }
    
            if (dependencies.primary.length > 0 || dependencies.dev.length > 0) {
                result.dependencies = {};
                if (dependencies.primary.length > 0) {
                    result.dependencies.primary = dependencies.primary;
                }
                if (dependencies.dev.length > 0) {
                    result.dependencies.dev = dependencies.dev;
                }
            }
    
            if (configFiles.length > 0) {
                result.configFiles = configFiles;
            }
    
            if (truncated) {
                result.truncated = true;
            }
    
            return result;
    
        } catch (err) {
            return createError(ErrorCodes.SCAN_ERROR, err.message);
        }
    }
  • Input schema for the inspect_project tool using Zod validation.
    export const inspectProjectSchema = {
        path: z.string().describe("Path to the project directory to inspect"),
        maxDepth: z.number().optional().default(3).describe("Maximum depth to scan (default: 3)"),
        includeHidden: z.boolean().optional().default(false).describe("Include hidden files and directories")
    };
  • index.js:19-37 (registration)
    MCP server tool registration for inspect_project, using imported schema and handler.
    server.registerTool(
        "inspect_project",
        {
            title: "Inspect Project",
            description: "Analyze a project directory and return a complete snapshot including detected languages, frameworks, entry points, structure summary, and dependencies. This is the primary tool for understanding a project.",
            inputSchema: inspectProjectSchema
        },
        async (params) => {
            const result = await inspectProject(params);
            return {
                content: [
                    {
                        type: "text",
                        text: JSON.stringify(result, null, 2),
                    },
                ],
            };
        }
    );
  • server.js:32-44 (registration)
    Tool definition/registration for HTTP/SSE server, with inline schema and imported handler.
    inspect_project: {
        name: "inspect_project",
        description: "Analyze a project directory and return a complete snapshot including detected languages, frameworks, entry points, structure summary, and dependencies. This is the primary tool for understanding a project.",
        inputSchema: {
            type: "object",
            properties: {
                path: { type: "string", description: "Path to the project directory to inspect" },
                maxDepth: { type: "number", description: "Maximum depth to scan (default: 3)" },
                includeHidden: { type: "boolean", description: "Include hidden files and directories" }
            },
            required: ["path"]
        },
        handler: inspectProject
  • api/index.js:10-13 (registration)
    Simple tool mapping for Vercel serverless API handler, mapping 'inspect_project' to inspectProject function.
    const tools = {
        inspect_project: inspectProject,
        detect_stack: detectStack,
        list_key_files: listKeyFiles
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 of behavioral disclosure. It mentions the tool returns a 'complete snapshot' but lacks details on performance (e.g., speed, resource usage), error handling, or output format. It adds some context about the analysis scope but is incomplete for a tool with no annotations.

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

Conciseness5/5

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

The description is front-loaded with the core purpose and output, using two concise sentences with zero waste. Every word earns its place, making it easy for an AI agent to quickly grasp the tool's role.

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

Completeness3/5

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

Given the complexity of analyzing a project directory with no annotations and no output schema, the description is adequate but has clear gaps. It outlines what the tool does but lacks details on behavioral traits, output structure, or limitations, making it minimally viable for agent use.

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 100%, so the schema fully documents all three parameters. The description does not add any meaning beyond the schema, such as explaining how 'maxDepth' affects the analysis or what 'includeHidden' might reveal. Baseline 3 is appropriate when the schema does the heavy lifting.

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 specific action ('Analyze a project directory') and the comprehensive output ('complete snapshot including detected languages, frameworks, entry points, structure summary, and dependencies'), distinguishing it from sibling tools like 'detect_stack' and 'list_key_files' by emphasizing breadth of analysis.

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 as 'the primary tool for understanding a project,' implying it should be used for initial comprehensive analysis. However, it does not explicitly state when to use alternatives like 'detect_stack' or 'list_key_files,' nor does it mention exclusions or prerequisites.

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/QoutaID/qoutaMcp'

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