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,
          },
        ],
      };
    }
Behavior4/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 effectively describes key behavioral traits: it's a read-only operation (implied by 'Get'), returns structure without file contents, and is optimized for 'clean' output. However, it doesn't mention potential limitations like error handling, performance characteristics, or output format details, leaving some gaps in behavioral understanding.

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 extremely concise and well-structured in just two sentences. Every word earns its place: the first sentence states purpose and key differentiators, the second provides usage guidance and limitations. It's front-loaded with the most important information ('PREFERRED OVER ls/tree') and wastes no space on redundant information.

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

Completeness4/5

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

Given the tool's moderate complexity (2 parameters, no output schema, no annotations), the description provides good contextual coverage. It clearly explains what the tool does, when to use it, and what it doesn't do. However, without an output schema, the description doesn't specify what the structure output looks like (e.g., tree format, JSON, etc.), leaving some ambiguity about the return value.

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 already documents both parameters thoroughly. The description doesn't add any parameter-specific information beyond what's in the schema descriptions. It mentions 'specific subdirectory to analyze' and 'depth' implicitly through context but provides no additional syntax, format, or usage details for parameters.

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 tool's purpose: 'Get clean repository structure showing directories and file types.' It specifies the verb ('Get'), resource ('repository structure'), and scope ('directories and file types'), and explicitly distinguishes it from sibling tools by stating it's 'PREFERRED OVER ls/tree' and should be used 'INSTEAD OF running ls, tree, or Glob.'

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

Usage Guidelines5/5

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

The description provides explicit guidance on when to use this tool versus alternatives: 'Use this INSTEAD OF running ls, tree, or Glob for understanding project layout.' It also clarifies the tool's limitations: 'No file contents, just structure,' which helps define appropriate use cases. This directly addresses when to choose this tool over other methods.

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

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