Skip to main content
Glama
transparentlyok

MCP Context Manager

get_repository_structure

Analyze project layout by retrieving directory structure and file types without reading file contents. Use to understand repository organization and navigate codebases efficiently.

Instructions

⭐ PREFERRED OVER ls/tree: Get clean repository structure showing directories and file types. Use this INSTEAD OF running ls, tree, or Glob for understanding project layout. No file contents, just structure.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathNoOptional: specific subdirectory to analyze. Default: root
depthNoMaximum depth to traverse. Default: 3

Implementation Reference

  • The handler for get_repository_structure, which builds a directory tree for the repository or a specified subdirectory.
    async getRepositoryStructure(subPath?: string, depth: number = 3): Promise<string> {
      const rootPath = this.indexer.getRootPath();
      const targetPath = subPath ? path.join(rootPath, subPath) : rootPath;
    
      const structure = await this.buildDirectoryTree(targetPath, rootPath, depth, 0);
      return `Repository Structure:\n${subPath ? `Path: ${subPath}\n` : ''}\n${structure}`;
    }
  • Tool registration and input schema definition for get_repository_structure.
    name: 'get_repository_structure',
    description: '⭐ PREFERRED OVER ls/tree: Get clean repository structure showing directories and file types. Use this INSTEAD OF running ls, tree, or Glob for understanding project layout. No file contents, just structure.',
    inputSchema: {
      type: 'object',
      properties: {
        path: {
          type: 'string',
          description: 'Optional: specific subdirectory to analyze. Default: root',
        },
        depth: {
          type: 'number',
          description: 'Maximum depth to traverse. Default: 3',
        },
      },
    },
  • src/index.ts:531-542 (registration)
    The switch case handler that routes the MCP call to the retriever method.
    case 'get_repository_structure': {
      const { path, depth } = args as { path?: string; depth?: number };
      const result = await retriever.getRepositoryStructure(path, depth || 3);
      return {
        content: [
          {
            type: 'text',
            text: result,
          },
        ],
      };
    }

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/transparentlyok/mcp-context-manager'

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