Skip to main content
Glama

localnest_summarize_project

Generate a concise project summary by analyzing directory structure and files to provide high-level insights into codebase organization and content.

Instructions

Return a high-level summary of a project directory.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
project_pathYes
max_filesNo
response_formatNojson

Implementation Reference

  • The core logic for summarizing a project, counting file extensions and directory structures.
    export function summarizeProject(workspace, projectPath, maxFiles) {
      const root = normalizeTarget(workspace, projectPath);
      const st = fs.statSync(root);
      if (!st.isDirectory()) {
        throw new Error('project_path is not a directory');
      }
    
      const counts = new Map();
      let totalFiles = 0;
      let totalDirs = 0;
    
      for (const { dirs, files } of walkDirectories(workspace, root)) {
        totalDirs += dirs.length;
    
        for (const filePath of files) {
          if (path.basename(filePath).startsWith('.')) continue;
          totalFiles += 1;
    
          const ext = path.extname(filePath).toLowerCase() || '<none>';
          counts.set(ext, (counts.get(ext) || 0) + 1);
    
          if (totalFiles >= maxFiles) break;
        }
    
        if (totalFiles >= maxFiles) break;
      }
    
      const topExtensions = Array.from(counts.entries())
        .sort((a, b) => b[1] - a[1])
        .slice(0, 15)
        .map(([ext, count]) => ({ ext, count }));
    
      return {
        path: root,
        directories: totalDirs,
        files_counted: totalFiles,
        top_extensions: topExtensions,
        truncated: totalFiles >= maxFiles
      };
    }
    
    export async function readFileChunk(workspace, requestedPath, startLine, endLine, maxSpan) {
      let from = startLine;
      let to = endLine;
    
      if (to < from) to = from;
      if (to - from + 1 > maxSpan) {
        to = from + maxSpan - 1;
  • The registration and entry point for the 'localnest_summarize_project' tool, which calls the service wrapper.
    registerJsonTool(
      'localnest_summarize_project',
      {
        title: 'Summarize Project',
        description: 'Return a high-level summary of a project directory.',
        inputSchema: {
          project_path: z.string(),
          max_files: z.number().int().min(100).max(20000).default(3000)
        },
        annotations: {
          readOnlyHint: true,
          destructiveHint: false,
          idempotentHint: true,
          openWorldHint: false
        }
      },
      async ({ project_path, max_files }) => normalizeProjectSummaryResult(
        workspace.summarizeProject(project_path, max_files),

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/wmt-mobile/localnest'

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